diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index 8e1cc56bd4a0..4c948c4dbcd0 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,12 +1,12 @@ { - "commit": "50ed4464b0e2a90e5d313b83bcb00a28762dd80f", + "commit": "fa41e956d698071f50b8b025906edc831a94f807", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.15.0", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.15.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/compute/resource-manager/readme.md", "package-2024-03-02-only": "2024-07-16 12:23:13 -0400 602fb5144a226577186e35845422c11db9067cf8 Microsoft.Compute/DiskRP/stable/2024-03-02/snapshot.json", "package-2024-03-01-only": "2024-06-05 15:03:47 -0700 491e00d17f24909ecf5e1030b3833bed51224e92 Microsoft.Compute/ComputeRP/stable/2024-03-01/virtualMachineScaleSet.json", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_operations.py index 30406546be0d..eafd96425c72 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -809,6 +811,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -817,15 +820,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1019,6 +1021,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1027,11 +1030,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1209,6 +1215,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1217,18 +1224,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1962,6 +1965,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1970,15 +1974,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2161,6 +2164,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2169,15 +2173,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2335,6 +2338,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2343,18 +2347,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2506,6 +2506,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2514,15 +2515,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2913,6 +2913,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2921,15 +2922,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3025,6 +3025,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3033,15 +3034,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3136,6 +3136,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3144,15 +3145,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3247,6 +3247,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3255,15 +3256,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3397,6 +3397,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3405,15 +3406,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3573,6 +3573,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3581,18 +3582,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3761,6 +3758,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3769,15 +3767,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3966,6 +3963,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3974,15 +3972,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4466,6 +4463,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4474,15 +4472,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4674,6 +4671,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4682,15 +4680,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4876,6 +4873,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4884,15 +4882,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5075,6 +5072,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5083,15 +5081,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5258,6 +5255,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5266,15 +5264,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5393,6 +5390,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5401,15 +5399,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5510,6 +5507,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5518,15 +5516,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5629,6 +5626,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5637,18 +5635,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5968,6 +5962,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5976,15 +5971,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6087,6 +6081,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6095,15 +6090,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6204,6 +6198,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6212,15 +6207,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_operations.py index 67de71047b33..755aa63a52d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -2547,6 +2549,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2555,15 +2558,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2757,6 +2759,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2765,11 +2768,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2947,6 +2953,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2955,18 +2962,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3699,6 +3702,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3707,15 +3711,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3897,6 +3900,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3905,15 +3909,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4068,6 +4071,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4076,18 +4080,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4239,6 +4239,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4247,15 +4248,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4640,6 +4640,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4648,15 +4649,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4751,6 +4751,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4759,15 +4760,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4861,6 +4861,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4869,15 +4870,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4971,6 +4971,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4979,15 +4980,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5120,6 +5120,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5128,15 +5129,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5294,6 +5294,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5302,18 +5303,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5480,6 +5477,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5488,15 +5486,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5684,6 +5681,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5692,15 +5690,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6183,6 +6180,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6191,15 +6189,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6390,6 +6387,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6398,15 +6396,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6591,6 +6588,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6599,15 +6597,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6789,6 +6786,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6797,15 +6795,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6969,6 +6966,7 @@ def _reimage_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6977,15 +6975,14 @@ def _reimage_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7103,6 +7100,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7111,15 +7109,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7219,6 +7216,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7227,15 +7225,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7337,6 +7334,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7345,18 +7343,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7676,6 +7670,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7684,15 +7679,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7794,6 +7788,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7802,15 +7797,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7910,6 +7904,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7918,15 +7913,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py index 982a31433cf3..3af17bdc6d6b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -892,6 +894,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -900,15 +903,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1102,6 +1104,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1110,11 +1113,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1292,6 +1298,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1300,18 +1307,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1573,6 +1576,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1581,15 +1585,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1772,6 +1775,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1780,15 +1784,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1946,6 +1949,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1954,18 +1958,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2117,6 +2117,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2125,15 +2126,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2524,6 +2524,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2532,15 +2533,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2636,6 +2636,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2644,15 +2645,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2747,6 +2747,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2755,15 +2756,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2858,6 +2858,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2866,15 +2867,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3539,6 +3539,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3547,15 +3548,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3715,6 +3715,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3723,18 +3724,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3903,6 +3900,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3911,15 +3909,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4108,6 +4105,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4116,15 +4114,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4608,6 +4605,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4616,15 +4614,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4816,6 +4813,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4824,15 +4822,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5018,6 +5015,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5026,15 +5024,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5217,6 +5214,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5225,15 +5223,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5400,6 +5397,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5408,15 +5406,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5535,6 +5532,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5543,15 +5541,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5652,6 +5649,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5660,15 +5658,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5771,6 +5768,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5779,18 +5777,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6110,6 +6104,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6118,15 +6113,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6229,6 +6223,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6237,15 +6232,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6346,6 +6340,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6354,15 +6349,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py index a279c75b0964..7194a5701b7e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -2688,6 +2690,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2696,15 +2699,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2898,6 +2900,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2906,11 +2909,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3088,6 +3094,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3096,18 +3103,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3369,6 +3372,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3377,15 +3381,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3567,6 +3570,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3575,15 +3579,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3738,6 +3741,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3746,18 +3750,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3909,6 +3909,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3917,15 +3918,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4310,6 +4310,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4318,15 +4319,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4421,6 +4421,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4429,15 +4430,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4531,6 +4531,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4539,15 +4540,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4641,6 +4641,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4649,15 +4650,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5320,6 +5320,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5328,15 +5329,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5494,6 +5494,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5502,18 +5503,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5680,6 +5677,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5688,15 +5686,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5884,6 +5881,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5892,15 +5890,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6383,6 +6380,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6391,15 +6389,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6590,6 +6587,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6598,15 +6596,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6791,6 +6788,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6799,15 +6797,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6989,6 +6986,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6997,15 +6995,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7169,6 +7166,7 @@ def _reimage_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7177,15 +7175,14 @@ def _reimage_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7303,6 +7300,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7311,15 +7309,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7419,6 +7416,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7427,15 +7425,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7537,6 +7534,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7545,18 +7543,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7876,6 +7870,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7884,15 +7879,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7994,6 +7988,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8002,15 +7997,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8110,6 +8104,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8118,15 +8113,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_operations.py index ff94aea2823e..fbd181e38ff4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -930,6 +932,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -938,15 +941,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1145,6 +1147,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1153,11 +1156,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1339,6 +1345,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1347,18 +1354,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1628,6 +1631,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1636,15 +1640,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1832,6 +1835,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1840,15 +1844,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2010,6 +2013,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2018,18 +2022,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2189,6 +2189,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2197,15 +2198,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2305,6 +2305,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2313,15 +2314,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2724,6 +2724,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2732,15 +2733,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2840,6 +2840,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2848,15 +2849,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2955,6 +2955,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2963,15 +2964,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3070,6 +3070,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3078,15 +3079,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3766,6 +3766,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3774,15 +3775,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3937,6 +3937,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3945,18 +3946,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4310,6 +4307,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4318,15 +4316,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4491,6 +4488,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4499,18 +4497,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4685,6 +4679,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4693,15 +4688,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4894,6 +4888,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4902,15 +4897,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5407,6 +5401,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5415,15 +5410,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5619,6 +5613,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5627,15 +5622,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5825,6 +5819,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5833,15 +5828,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6028,6 +6022,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6036,15 +6031,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6216,6 +6210,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6224,15 +6219,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6333,6 +6327,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6341,15 +6336,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6473,6 +6467,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6481,15 +6476,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6594,6 +6588,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6602,15 +6597,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6716,6 +6710,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6724,15 +6719,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6839,6 +6833,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6847,18 +6842,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7184,6 +7175,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7192,15 +7184,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7307,6 +7298,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7315,15 +7307,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7428,6 +7419,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7436,15 +7428,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7581,6 +7572,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7589,15 +7581,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7769,6 +7760,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7777,15 +7769,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8001,6 +7992,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8009,18 +8001,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8293,6 +8281,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8301,15 +8290,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8482,6 +8470,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8490,15 +8479,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8634,6 +8622,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8642,15 +8631,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8829,6 +8817,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8837,15 +8826,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9071,6 +9059,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9079,18 +9068,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9362,6 +9347,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9370,15 +9356,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9548,6 +9533,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9556,15 +9542,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_operations.py index 66d6926b3460..8d26b7271d35 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -3447,6 +3449,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3455,15 +3458,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3662,6 +3664,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3670,11 +3673,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3856,6 +3862,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3864,18 +3871,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4145,6 +4148,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4153,15 +4157,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4348,6 +4351,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4356,15 +4360,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4526,6 +4529,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4534,18 +4538,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4705,6 +4705,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4713,15 +4714,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4820,6 +4820,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4828,15 +4829,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5236,6 +5236,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5244,15 +5245,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5351,6 +5351,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5359,15 +5360,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5465,6 +5465,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5473,15 +5474,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5579,6 +5579,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5587,15 +5588,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6273,6 +6273,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6281,15 +6282,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6441,6 +6441,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6449,18 +6450,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6812,6 +6809,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6820,15 +6818,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6991,6 +6988,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6999,18 +6997,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7183,6 +7177,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7191,15 +7186,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7391,6 +7385,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7399,15 +7394,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7903,6 +7897,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7911,15 +7906,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8114,6 +8108,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8122,15 +8117,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8319,6 +8313,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8327,15 +8322,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8521,6 +8515,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8529,15 +8524,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8706,6 +8700,7 @@ def _reimage_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8714,15 +8709,14 @@ def _reimage_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8820,6 +8814,7 @@ def _reimage_all_initial(self, resource_group_name: str, vm_scale_set_name: str, ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8828,15 +8823,14 @@ def _reimage_all_initial(self, resource_group_name: str, vm_scale_set_name: str, response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8959,6 +8953,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8967,15 +8962,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9079,6 +9073,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9087,15 +9082,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9200,6 +9194,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9208,15 +9203,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9322,6 +9316,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9330,18 +9325,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9667,6 +9658,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9675,15 +9667,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9789,6 +9780,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9797,15 +9789,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9909,6 +9900,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9917,15 +9909,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10061,6 +10052,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10069,15 +10061,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10249,6 +10240,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10257,15 +10249,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10481,6 +10472,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10489,18 +10481,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10771,6 +10759,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10779,15 +10768,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10952,6 +10940,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10960,15 +10949,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11103,6 +11091,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11111,15 +11100,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11292,6 +11280,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11300,15 +11289,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11526,6 +11514,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11534,18 +11523,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11815,6 +11800,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11823,15 +11809,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11993,6 +11978,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12001,15 +11987,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py index b3df1ff1c172..079fa2ba418c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -935,6 +937,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -943,15 +946,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1145,6 +1147,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1153,11 +1156,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1335,6 +1341,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1343,18 +1350,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1695,6 +1698,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1703,15 +1707,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1894,6 +1897,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1902,15 +1906,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2068,6 +2071,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2076,18 +2080,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2297,6 +2297,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2305,15 +2306,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2409,6 +2409,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2417,15 +2418,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2816,6 +2816,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2824,15 +2825,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2928,6 +2928,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2936,15 +2937,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3039,6 +3039,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3047,15 +3048,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3150,6 +3150,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3158,15 +3159,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3263,6 +3263,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3271,15 +3272,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3392,6 +3392,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3400,15 +3401,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4135,6 +4135,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4143,15 +4144,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4299,6 +4299,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4307,18 +4308,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4756,6 +4753,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4764,15 +4762,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4948,6 +4945,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4956,11 +4954,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5121,6 +5122,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5129,18 +5131,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5309,6 +5307,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5317,15 +5316,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5514,6 +5512,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5522,15 +5521,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6014,6 +6012,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6022,15 +6021,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6222,6 +6220,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6230,15 +6229,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6424,6 +6422,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6432,15 +6431,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6623,6 +6621,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6631,15 +6630,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6825,6 +6823,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6833,15 +6832,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7027,6 +7025,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7035,15 +7034,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7252,6 +7250,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7260,15 +7259,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7446,6 +7444,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7454,18 +7453,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7736,6 +7731,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7744,15 +7740,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7849,6 +7844,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7857,15 +7853,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8042,6 +8037,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8050,15 +8046,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8159,6 +8154,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8167,15 +8163,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8277,6 +8272,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8285,15 +8281,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8396,6 +8391,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8404,18 +8400,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8735,6 +8727,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8743,15 +8736,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8854,6 +8846,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8862,15 +8855,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8971,6 +8963,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8979,15 +8972,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9120,6 +9112,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9128,15 +9121,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9304,6 +9296,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9312,15 +9305,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9530,6 +9522,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9538,18 +9531,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9812,6 +9801,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9820,15 +9810,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9993,6 +9982,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10001,15 +9991,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10141,6 +10130,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10149,15 +10139,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10332,6 +10321,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10340,15 +10330,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10569,6 +10558,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10577,18 +10567,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10853,6 +10839,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10861,15 +10848,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11034,6 +11020,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11042,15 +11029,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py index 0c78e8d56714..23af9607c919 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -3917,6 +3919,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3925,15 +3928,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4127,6 +4129,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4135,11 +4138,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4317,6 +4323,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4325,18 +4332,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4676,6 +4679,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4684,15 +4688,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4874,6 +4877,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4882,15 +4886,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5045,6 +5048,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5053,18 +5057,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5274,6 +5274,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5282,15 +5283,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5385,6 +5385,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5393,15 +5394,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5786,6 +5786,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5794,15 +5795,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5897,6 +5897,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5905,15 +5906,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6007,6 +6007,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6015,15 +6016,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6117,6 +6117,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6125,15 +6126,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6227,6 +6227,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6235,15 +6236,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6355,6 +6355,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6363,15 +6364,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7093,6 +7093,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7101,15 +7102,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7257,6 +7257,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7265,18 +7266,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7713,6 +7710,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7721,15 +7719,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7905,6 +7902,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7913,11 +7911,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8076,6 +8077,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8084,18 +8086,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8262,6 +8260,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8270,15 +8269,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8466,6 +8464,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8474,15 +8473,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8965,6 +8963,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8973,15 +8972,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9172,6 +9170,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9180,15 +9179,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9373,6 +9371,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9381,15 +9380,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9571,6 +9569,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9579,15 +9578,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9772,6 +9770,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9780,15 +9779,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9973,6 +9971,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9981,15 +9980,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10197,6 +10195,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10205,15 +10204,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10391,6 +10389,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10399,18 +10398,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10679,6 +10674,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10687,15 +10683,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10791,6 +10786,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10799,15 +10795,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10983,6 +10978,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10991,15 +10987,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11099,6 +11094,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11107,15 +11103,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11216,6 +11211,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11224,15 +11220,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11334,6 +11329,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11342,18 +11338,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11673,6 +11665,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11681,15 +11674,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11791,6 +11783,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11799,15 +11792,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11907,6 +11899,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11915,15 +11908,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12055,6 +12047,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12063,15 +12056,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12239,6 +12231,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12247,15 +12240,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12465,6 +12457,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12473,18 +12466,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12747,6 +12736,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12755,15 +12745,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12923,6 +12912,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12931,15 +12921,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13070,6 +13059,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13078,15 +13068,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13258,6 +13247,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13266,15 +13256,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13490,6 +13479,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13498,18 +13488,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13772,6 +13758,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13780,15 +13767,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13948,6 +13934,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13956,15 +13943,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py index d05f80e04892..2a6c78e0141b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1154,6 +1156,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1162,15 +1165,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1364,6 +1366,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1372,11 +1375,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1554,6 +1560,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1562,18 +1569,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1914,6 +1917,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1922,15 +1926,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2113,6 +2116,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2121,15 +2125,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2305,6 +2308,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2313,15 +2317,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2479,6 +2482,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2487,18 +2491,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2708,6 +2708,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2716,15 +2717,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2820,6 +2820,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2828,15 +2829,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3227,6 +3227,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3235,15 +3236,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3339,6 +3339,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3347,15 +3348,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3450,6 +3450,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3458,15 +3459,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3561,6 +3561,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3569,15 +3570,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3674,6 +3674,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3682,15 +3683,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3803,6 +3803,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3811,15 +3812,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4546,6 +4546,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4554,15 +4555,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4728,6 +4728,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4736,15 +4737,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4896,6 +4896,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4904,18 +4905,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5257,6 +5254,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5265,15 +5263,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5449,6 +5446,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5457,11 +5455,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5622,6 +5623,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5630,18 +5632,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5810,6 +5808,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5818,15 +5817,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6015,6 +6013,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6023,15 +6022,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6599,6 +6597,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6607,15 +6606,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6807,6 +6805,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6815,15 +6814,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7009,6 +7007,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7017,15 +7016,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7211,6 +7209,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7219,15 +7218,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7416,6 +7414,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7424,15 +7423,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7624,6 +7622,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7632,15 +7631,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7826,6 +7824,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7834,15 +7833,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8028,6 +8026,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8036,15 +8035,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8314,6 +8312,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8322,15 +8321,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8508,6 +8506,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8516,18 +8515,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8798,6 +8793,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8806,15 +8802,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8911,6 +8906,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8919,15 +8915,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9104,6 +9099,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9112,15 +9108,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9221,6 +9216,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9229,15 +9225,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9339,6 +9334,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9347,15 +9343,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9475,6 +9470,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9483,15 +9479,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9667,6 +9662,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9675,18 +9671,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10006,6 +9998,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10014,15 +10007,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10125,6 +10117,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10133,15 +10126,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10242,6 +10234,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10250,15 +10243,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10359,6 +10351,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10367,15 +10360,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10477,6 +10469,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10485,15 +10478,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10625,6 +10617,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10633,15 +10626,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10803,6 +10795,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10811,15 +10804,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py index 6cc47ae0c8f8..31683121efce 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -4040,6 +4042,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4048,15 +4051,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4250,6 +4252,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4258,11 +4261,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4440,6 +4446,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4448,18 +4455,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4799,6 +4802,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4807,15 +4811,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4997,6 +5000,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5005,15 +5009,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5186,6 +5189,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5194,15 +5198,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5357,6 +5360,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5365,18 +5369,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5586,6 +5586,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5594,15 +5595,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5697,6 +5697,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5705,15 +5706,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6098,6 +6098,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6106,15 +6107,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6209,6 +6209,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6217,15 +6218,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6319,6 +6319,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6327,15 +6328,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6429,6 +6429,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6437,15 +6438,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6539,6 +6539,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6547,15 +6548,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6667,6 +6667,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6675,15 +6676,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7405,6 +7405,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7413,15 +7414,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7587,6 +7587,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7595,15 +7596,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7755,6 +7755,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7763,18 +7764,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8116,6 +8113,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8124,15 +8122,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8308,6 +8305,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8316,11 +8314,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8479,6 +8480,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8487,18 +8489,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8665,6 +8663,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8673,15 +8672,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8869,6 +8867,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8877,15 +8876,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9452,6 +9450,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9460,15 +9459,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9659,6 +9657,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9667,15 +9666,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9860,6 +9858,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9868,15 +9867,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10061,6 +10059,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10069,15 +10068,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10265,6 +10263,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10273,15 +10272,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10472,6 +10470,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10480,15 +10479,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10673,6 +10671,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10681,15 +10680,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10874,6 +10872,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10882,15 +10881,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11159,6 +11157,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11167,15 +11166,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11353,6 +11351,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11361,18 +11360,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11641,6 +11636,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11649,15 +11645,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11753,6 +11748,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11761,15 +11757,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11945,6 +11940,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11953,15 +11949,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12061,6 +12056,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12069,15 +12065,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12178,6 +12173,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12186,15 +12182,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12313,6 +12308,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12321,15 +12317,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12505,6 +12500,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12513,18 +12509,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12844,6 +12836,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12852,15 +12845,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12962,6 +12954,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12970,15 +12963,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13078,6 +13070,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13086,15 +13079,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13194,6 +13186,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13202,15 +13195,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13311,6 +13303,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13319,15 +13312,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13458,6 +13450,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13466,15 +13459,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13635,6 +13627,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13643,15 +13636,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py index 52ab08659c8c..4a2263850542 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1033,11 +1035,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1720,6 +1718,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1728,15 +1727,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1930,6 +1928,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1938,11 +1937,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2120,6 +2122,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2128,18 +2131,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2906,6 +2905,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2914,15 +2914,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3104,6 +3103,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3112,15 +3112,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3296,6 +3295,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3304,15 +3304,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3470,6 +3469,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3478,18 +3478,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3691,6 +3687,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3699,15 +3696,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3794,6 +3790,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3802,15 +3799,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4186,6 +4182,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4194,15 +4191,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4287,6 +4283,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4295,15 +4292,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4387,6 +4383,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4395,15 +4392,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4487,6 +4483,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4495,15 +4492,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4589,6 +4585,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4597,15 +4594,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4709,6 +4705,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4717,15 +4714,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5019,6 +5015,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5027,15 +5024,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5201,6 +5197,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5209,15 +5206,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5369,6 +5365,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5377,18 +5374,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5722,6 +5715,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5730,15 +5724,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5914,6 +5907,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5922,11 +5916,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6087,6 +6084,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6095,18 +6093,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6269,6 +6263,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6277,15 +6272,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6461,6 +6455,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6469,15 +6464,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7032,6 +7026,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7040,15 +7035,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7227,6 +7221,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7235,15 +7230,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7416,6 +7410,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7424,15 +7419,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7605,6 +7599,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7613,15 +7608,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7797,6 +7791,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7805,15 +7800,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7992,6 +7986,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8000,15 +7995,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8181,6 +8175,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8189,15 +8184,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8370,6 +8364,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8378,15 +8373,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8643,6 +8637,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8651,15 +8646,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8837,6 +8831,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8845,18 +8840,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9121,6 +9112,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9129,15 +9121,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9225,6 +9216,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9233,15 +9225,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9409,6 +9400,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9417,15 +9409,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9517,6 +9508,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9525,15 +9517,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9626,6 +9617,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9634,15 +9626,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9753,6 +9744,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9761,15 +9753,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9945,6 +9936,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9953,18 +9945,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10278,6 +10266,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10286,15 +10275,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10388,6 +10376,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10396,15 +10385,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10496,6 +10484,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10504,15 +10493,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10604,6 +10592,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10612,15 +10601,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10713,6 +10701,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10721,15 +10710,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10838,6 +10826,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10846,15 +10835,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11058,6 +11046,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11066,15 +11055,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11236,6 +11224,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11244,15 +11233,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11587,6 +11575,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11595,15 +11584,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11771,6 +11759,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11779,15 +11768,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11997,6 +11985,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12005,18 +11994,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12271,6 +12256,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12279,15 +12265,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12454,6 +12439,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12462,15 +12448,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12595,6 +12580,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12603,15 +12589,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12786,6 +12771,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12794,15 +12780,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13023,6 +13008,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13031,18 +13017,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13299,6 +13281,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13307,15 +13290,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13482,6 +13464,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13490,15 +13473,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py index b9c3bba90864..0f087baf6856 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -4415,11 +4417,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5102,6 +5100,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5110,15 +5109,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5312,6 +5310,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5320,11 +5319,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5502,6 +5504,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5510,18 +5513,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6287,6 +6286,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6295,15 +6295,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6485,6 +6484,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6493,15 +6493,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6674,6 +6673,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6682,15 +6682,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6845,6 +6844,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6853,18 +6853,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7066,6 +7062,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7074,15 +7071,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7167,6 +7163,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7175,15 +7172,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7556,6 +7552,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7564,15 +7561,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7657,6 +7653,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7665,15 +7662,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7757,6 +7753,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7765,15 +7762,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7857,6 +7853,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7865,15 +7862,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7957,6 +7953,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7965,15 +7962,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8075,6 +8071,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8083,15 +8080,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8381,6 +8377,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8389,15 +8386,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8563,6 +8559,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8571,15 +8568,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8731,6 +8727,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8739,18 +8736,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9084,6 +9077,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9092,15 +9086,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9276,6 +9269,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9284,11 +9278,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9447,6 +9444,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9455,18 +9453,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9625,6 +9619,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9633,15 +9628,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9817,6 +9811,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9825,15 +9820,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10388,6 +10382,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10396,15 +10391,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10583,6 +10577,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10591,15 +10586,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10772,6 +10766,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10780,15 +10775,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10961,6 +10955,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10969,15 +10964,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11153,6 +11147,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11161,15 +11156,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11348,6 +11342,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11356,15 +11351,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11537,6 +11531,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11545,15 +11540,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11726,6 +11720,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11734,15 +11729,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11999,6 +11993,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12007,15 +12002,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12193,6 +12187,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12201,18 +12196,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12475,6 +12466,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12483,15 +12475,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12577,6 +12568,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12585,15 +12577,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12761,6 +12752,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12769,15 +12761,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12869,6 +12860,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12877,15 +12869,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12978,6 +12969,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12986,15 +12978,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13105,6 +13096,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13113,15 +13105,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13297,6 +13288,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13305,18 +13297,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13630,6 +13618,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13638,15 +13627,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13740,6 +13728,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13748,15 +13737,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13848,6 +13836,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13856,15 +13845,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13956,6 +13944,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13964,15 +13953,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14065,6 +14053,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14073,15 +14062,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14190,6 +14178,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14198,15 +14187,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14407,6 +14395,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14415,15 +14404,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14584,6 +14572,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14592,15 +14581,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14934,6 +14922,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14942,15 +14931,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15118,6 +15106,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15126,15 +15115,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15344,6 +15332,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15352,18 +15341,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15618,6 +15603,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15626,15 +15612,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15796,6 +15781,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15804,15 +15790,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15935,6 +15920,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15943,15 +15929,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16123,6 +16108,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16131,15 +16117,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16355,6 +16340,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16363,18 +16349,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16629,6 +16611,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16637,15 +16620,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16807,6 +16789,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16815,15 +16798,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py index 43345a6e1487..29dc5ae3d989 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1048,11 +1050,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1735,6 +1733,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1743,15 +1742,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1945,6 +1943,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1953,11 +1952,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2135,6 +2137,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2143,18 +2146,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2921,6 +2920,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2929,15 +2929,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3119,6 +3118,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3127,15 +3127,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3311,6 +3310,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3319,15 +3319,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3485,6 +3484,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3493,18 +3493,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3706,6 +3702,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3714,15 +3711,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3809,6 +3805,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3817,15 +3814,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4201,6 +4197,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4209,15 +4206,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4302,6 +4298,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4310,15 +4307,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4402,6 +4398,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4410,15 +4407,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4502,6 +4498,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4510,15 +4507,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4623,6 +4619,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4631,15 +4628,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4792,6 +4788,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4800,15 +4797,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4912,6 +4908,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4920,15 +4917,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5223,6 +5219,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5231,15 +5228,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5405,6 +5401,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5413,15 +5410,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5573,6 +5569,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5581,18 +5578,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5926,6 +5919,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5934,15 +5928,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6118,6 +6111,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6126,11 +6120,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6291,6 +6288,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6299,18 +6297,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6473,6 +6467,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6481,15 +6476,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6665,6 +6659,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6673,15 +6668,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7236,6 +7230,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7244,15 +7239,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7431,6 +7425,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7439,15 +7434,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7620,6 +7614,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7628,15 +7623,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7809,6 +7803,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7817,15 +7812,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8001,6 +7995,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8009,15 +8004,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8196,6 +8190,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8204,15 +8199,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8385,6 +8379,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8393,15 +8388,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8578,6 +8572,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8586,15 +8581,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8851,6 +8845,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8859,15 +8854,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9045,6 +9039,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9053,18 +9048,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9329,6 +9320,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9337,15 +9329,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9433,6 +9424,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9441,15 +9433,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9539,6 +9530,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9547,15 +9539,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9745,6 +9736,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9753,15 +9745,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9929,6 +9920,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9937,15 +9929,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10038,6 +10029,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10046,15 +10038,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10165,6 +10156,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10173,15 +10165,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10357,6 +10348,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10365,18 +10357,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10690,6 +10678,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10698,15 +10687,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10800,6 +10788,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10808,15 +10797,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10908,6 +10896,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10916,15 +10905,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11016,6 +11004,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11024,15 +11013,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11125,6 +11113,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11133,15 +11122,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11250,6 +11238,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11258,15 +11247,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11470,6 +11458,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11478,15 +11467,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11648,6 +11636,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11656,15 +11645,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11999,6 +11987,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12007,18 +11996,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12231,6 +12216,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12239,18 +12225,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12526,6 +12508,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12534,18 +12517,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12784,6 +12763,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12792,18 +12772,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13020,6 +12996,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13028,18 +13005,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13320,6 +13293,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13328,18 +13302,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13562,6 +13532,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13570,15 +13541,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13746,6 +13716,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13754,15 +13725,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13972,6 +13942,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13980,18 +13951,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14246,6 +14213,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14254,15 +14222,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14429,6 +14396,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14437,15 +14405,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14570,6 +14537,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14578,15 +14546,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14761,6 +14728,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14769,15 +14737,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14998,6 +14965,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15006,18 +14974,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15274,6 +15238,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15282,15 +15247,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15457,6 +15421,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15465,15 +15430,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py index f40ff56052ee..64a356668745 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -4910,11 +4912,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5597,6 +5595,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5605,15 +5604,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5807,6 +5805,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5815,11 +5814,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5997,6 +5999,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6005,18 +6008,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6782,6 +6781,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6790,15 +6790,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6980,6 +6979,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6988,15 +6988,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7169,6 +7168,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7177,15 +7177,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7340,6 +7339,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7348,18 +7348,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7561,6 +7557,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7569,15 +7566,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7662,6 +7658,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7670,15 +7667,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8051,6 +8047,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8059,15 +8056,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8152,6 +8148,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8160,15 +8157,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8252,6 +8248,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8260,15 +8257,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8352,6 +8348,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8360,15 +8357,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8473,6 +8469,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8481,15 +8478,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8640,6 +8636,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8648,15 +8645,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8758,6 +8754,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8766,15 +8763,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9065,6 +9061,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9073,15 +9070,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9247,6 +9243,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9255,15 +9252,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9415,6 +9411,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9423,18 +9420,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9768,6 +9761,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9776,15 +9770,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9960,6 +9953,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9968,11 +9962,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10131,6 +10128,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10139,18 +10137,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10309,6 +10303,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10317,15 +10312,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10501,6 +10495,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10509,15 +10504,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11072,6 +11066,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11080,15 +11075,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11267,6 +11261,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11275,15 +11270,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11456,6 +11450,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11464,15 +11459,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11645,6 +11639,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11653,15 +11648,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11837,6 +11831,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11845,15 +11840,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12032,6 +12026,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12040,15 +12035,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12221,6 +12215,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12229,15 +12224,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12414,6 +12408,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12422,15 +12417,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12687,6 +12681,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12695,15 +12690,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12881,6 +12875,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12889,18 +12884,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13163,6 +13154,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13171,15 +13163,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13265,6 +13256,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13273,15 +13265,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13371,6 +13362,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13379,15 +13371,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13577,6 +13568,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13585,15 +13577,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13761,6 +13752,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13769,15 +13761,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13870,6 +13861,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13878,15 +13870,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13997,6 +13988,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14005,15 +13997,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14189,6 +14180,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14197,18 +14189,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14522,6 +14510,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14530,15 +14519,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14632,6 +14620,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14640,15 +14629,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14740,6 +14728,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14748,15 +14737,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14848,6 +14836,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14856,15 +14845,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14957,6 +14945,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14965,15 +14954,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15082,6 +15070,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15090,15 +15079,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15299,6 +15287,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15307,15 +15296,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15476,6 +15464,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15484,15 +15473,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15826,6 +15814,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15834,18 +15823,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16055,6 +16040,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16063,18 +16049,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16350,6 +16332,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16358,18 +16341,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16608,6 +16587,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16616,18 +16596,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16843,6 +16819,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16851,18 +16828,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17143,6 +17116,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17151,18 +17125,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17385,6 +17355,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17393,15 +17364,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17569,6 +17539,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17577,15 +17548,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17795,6 +17765,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17803,18 +17774,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18069,6 +18036,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18077,15 +18045,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18247,6 +18214,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18255,15 +18223,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18386,6 +18353,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18394,15 +18362,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18574,6 +18541,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18582,15 +18550,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18806,6 +18773,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18814,18 +18782,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19080,6 +19044,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19088,15 +19053,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19258,6 +19222,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19266,15 +19231,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_operations.py index c6c630ef9a7a..aaf024e21aa4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -116,6 +118,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -124,15 +127,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -300,6 +302,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -308,15 +311,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,6 +528,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -534,18 +537,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -800,6 +799,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -808,15 +808,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -983,6 +982,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -991,15 +991,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1124,6 +1123,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1132,15 +1132,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1315,6 +1314,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1323,15 +1323,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1552,6 +1551,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1560,18 +1560,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1828,6 +1824,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1836,15 +1833,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2011,6 +2007,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2019,15 +2016,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_operations.py index b8af0d9804fd..7f752bd8d329 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -575,6 +577,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -583,15 +586,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -759,6 +761,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -767,15 +770,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,6 +987,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -993,18 +996,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1259,6 +1258,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1267,15 +1267,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1437,6 +1436,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1445,15 +1445,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1576,6 +1575,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1584,15 +1584,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1764,6 +1763,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1772,15 +1772,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1996,6 +1995,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2004,18 +2004,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2270,6 +2266,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2278,15 +2275,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2448,6 +2444,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2456,15 +2453,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py index a972616bb10b..4797dc225973 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1019,11 +1021,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1706,6 +1704,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1714,15 +1713,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1916,6 +1914,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1924,11 +1923,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2106,6 +2108,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2114,18 +2117,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2892,6 +2891,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2900,15 +2900,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3090,6 +3089,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3098,15 +3098,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3282,6 +3281,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3290,15 +3290,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3456,6 +3455,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3464,18 +3464,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3677,6 +3673,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3685,15 +3682,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3780,6 +3776,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3788,15 +3785,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4172,6 +4168,7 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4180,15 +4177,14 @@ async def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4273,6 +4269,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4281,15 +4278,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4373,6 +4369,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4381,15 +4378,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4473,6 +4469,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4481,15 +4478,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4594,6 +4590,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4602,15 +4599,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4763,6 +4759,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4771,15 +4768,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4883,6 +4879,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4891,15 +4888,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5194,6 +5190,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5202,15 +5199,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5376,6 +5372,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5384,15 +5381,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5544,6 +5540,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5552,18 +5549,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5897,6 +5890,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5905,15 +5899,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6089,6 +6082,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6097,11 +6091,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6262,6 +6259,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6270,18 +6268,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6444,6 +6438,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6452,15 +6447,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6636,6 +6630,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6644,15 +6639,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7207,6 +7201,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7215,15 +7210,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7402,6 +7396,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7410,15 +7405,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7591,6 +7585,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7599,15 +7594,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7780,6 +7774,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7788,15 +7783,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7972,6 +7966,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7980,15 +7975,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8167,6 +8161,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8175,15 +8170,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8356,6 +8350,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8364,15 +8359,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8549,6 +8543,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8557,15 +8552,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8822,6 +8816,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8830,15 +8825,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9016,6 +9010,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9024,18 +9019,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9300,6 +9291,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9308,15 +9300,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9404,6 +9395,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9412,15 +9404,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9510,6 +9501,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9518,15 +9510,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9716,6 +9707,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9724,15 +9716,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9900,6 +9891,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9908,15 +9900,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10009,6 +10000,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10017,15 +10009,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10136,6 +10127,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10144,15 +10136,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10328,6 +10319,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10336,18 +10328,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10661,6 +10649,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10669,15 +10658,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10771,6 +10759,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10779,15 +10768,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10879,6 +10867,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10887,15 +10876,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10987,6 +10975,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10995,15 +10984,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11096,6 +11084,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11104,15 +11093,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11221,6 +11209,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11229,15 +11218,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11441,6 +11429,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11449,15 +11438,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11619,6 +11607,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11627,15 +11616,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py index c7154acbb30b..2a679bd7a3c6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -4003,11 +4005,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4690,6 +4688,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4698,15 +4697,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4900,6 +4898,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4908,11 +4907,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5090,6 +5092,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5098,18 +5101,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5875,6 +5874,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5883,15 +5883,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6073,6 +6072,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6081,15 +6081,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6262,6 +6261,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6270,15 +6270,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6433,6 +6432,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6441,18 +6441,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6654,6 +6650,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6662,15 +6659,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6755,6 +6751,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6763,15 +6760,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7144,6 +7140,7 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7152,15 +7149,14 @@ def _power_off_initial(self, resource_group_name: str, vm_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7245,6 +7241,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7253,15 +7250,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7345,6 +7341,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7353,15 +7350,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7445,6 +7441,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7453,15 +7450,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7566,6 +7562,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7574,15 +7571,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7733,6 +7729,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7741,15 +7738,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7851,6 +7847,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7859,15 +7856,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8158,6 +8154,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8166,15 +8163,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8340,6 +8336,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8348,15 +8345,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8508,6 +8504,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8516,18 +8513,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8861,6 +8854,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8869,15 +8863,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9053,6 +9046,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9061,11 +9055,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9224,6 +9221,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9232,18 +9230,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9402,6 +9396,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9410,15 +9405,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9594,6 +9588,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9602,15 +9597,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10165,6 +10159,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10173,15 +10168,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10360,6 +10354,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10368,15 +10363,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10549,6 +10543,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10557,15 +10552,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10738,6 +10732,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10746,15 +10741,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10930,6 +10924,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10938,15 +10933,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11125,6 +11119,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11133,15 +11128,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11314,6 +11308,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11322,15 +11317,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11507,6 +11501,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11515,15 +11510,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11780,6 +11774,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11788,15 +11783,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11974,6 +11968,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11982,18 +11977,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12256,6 +12247,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12264,15 +12256,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12358,6 +12349,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12366,15 +12358,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12464,6 +12455,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12472,15 +12464,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12670,6 +12661,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12678,15 +12670,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12854,6 +12845,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12862,15 +12854,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12963,6 +12954,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12971,15 +12963,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13090,6 +13081,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13098,15 +13090,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13282,6 +13273,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13290,18 +13282,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13615,6 +13603,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13623,15 +13612,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13725,6 +13713,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13733,15 +13722,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13833,6 +13821,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13841,15 +13830,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13941,6 +13929,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13949,15 +13938,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14050,6 +14038,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14058,15 +14047,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14175,6 +14163,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14183,15 +14172,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14392,6 +14380,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14400,15 +14389,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14569,6 +14557,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14577,15 +14566,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py index 08aec1d63da0..59cf4d66ba57 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1068,11 +1070,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1621,11 +1619,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2088,6 +2082,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2096,15 +2091,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2292,6 +2286,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2300,11 +2295,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2475,6 +2473,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2483,18 +2482,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2992,6 +2987,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3000,15 +2996,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3202,6 +3197,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3210,11 +3206,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3392,6 +3391,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3400,18 +3400,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4178,6 +4174,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4186,15 +4183,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4376,6 +4372,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4384,15 +4381,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4568,6 +4564,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4576,15 +4573,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4742,6 +4738,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4750,18 +4747,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4963,6 +4956,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4971,15 +4965,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5066,6 +5059,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5074,15 +5068,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5461,6 +5454,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5469,15 +5463,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5569,6 +5562,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5577,15 +5571,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5669,6 +5662,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5677,15 +5671,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5769,6 +5762,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5777,15 +5771,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5890,6 +5883,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5898,15 +5892,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6059,6 +6052,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6067,15 +6061,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6179,6 +6172,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6187,15 +6181,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6490,6 +6483,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6498,15 +6492,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6672,6 +6665,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6680,15 +6674,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6840,6 +6833,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6848,18 +6842,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7193,6 +7183,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7201,15 +7192,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7385,6 +7375,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7393,11 +7384,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7558,6 +7552,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7566,18 +7561,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7740,6 +7731,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7748,15 +7740,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7932,6 +7923,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7940,15 +7932,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8506,6 +8497,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8514,15 +8506,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8718,6 +8709,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8726,15 +8718,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8907,6 +8898,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8915,15 +8907,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9096,6 +9087,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9104,15 +9096,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9288,6 +9279,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9296,15 +9288,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9483,6 +9474,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9491,15 +9483,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9672,6 +9663,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9680,15 +9672,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9865,6 +9856,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9873,15 +9865,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10267,6 +10258,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10275,15 +10267,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10461,6 +10452,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10469,18 +10461,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10745,6 +10733,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10753,15 +10742,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10849,6 +10837,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10857,15 +10846,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10955,6 +10943,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10963,15 +10952,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11161,6 +11149,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11169,15 +11158,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11345,6 +11333,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11353,15 +11342,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11454,6 +11442,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11462,15 +11451,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11581,6 +11569,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11589,15 +11578,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11773,6 +11761,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11781,18 +11770,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12123,6 +12108,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12131,15 +12117,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12244,6 +12229,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12252,15 +12238,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12352,6 +12337,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12360,15 +12346,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12460,6 +12445,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12468,15 +12454,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12569,6 +12554,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12577,15 +12563,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12694,6 +12679,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12702,15 +12688,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12914,6 +12899,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12922,15 +12908,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13092,6 +13077,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13100,15 +13086,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13443,6 +13428,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13451,18 +13437,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13675,6 +13657,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13683,18 +13666,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13970,6 +13949,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13978,18 +13958,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14228,6 +14204,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14236,18 +14213,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14464,6 +14437,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14472,18 +14446,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14764,6 +14734,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14772,18 +14743,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15012,6 +14979,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15020,18 +14988,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15275,6 +15239,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15283,18 +15248,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15512,6 +15473,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15520,18 +15482,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15814,6 +15772,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15822,18 +15781,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16057,6 +16012,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16065,15 +16021,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16241,6 +16196,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16249,15 +16205,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16467,6 +16422,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16475,18 +16431,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16741,6 +16693,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16749,15 +16702,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16924,6 +16876,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16932,15 +16885,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17065,6 +17017,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17073,15 +17026,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17256,6 +17208,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17264,15 +17217,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17493,6 +17445,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17501,18 +17454,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17769,6 +17718,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17777,15 +17727,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17952,6 +17901,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17960,15 +17910,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py index 5e38d4ef2df1..c84ac45d493a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -5602,11 +5604,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6155,11 +6153,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6618,6 +6612,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6626,15 +6621,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6819,6 +6813,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6827,11 +6822,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6999,6 +6997,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7007,18 +7006,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7515,6 +7510,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7523,15 +7519,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7725,6 +7720,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7733,11 +7729,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7915,6 +7914,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7923,18 +7923,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8700,6 +8696,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8708,15 +8705,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8898,6 +8894,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8906,15 +8903,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9087,6 +9083,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9095,15 +9092,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9258,6 +9254,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9266,18 +9263,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9479,6 +9472,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9487,15 +9481,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9580,6 +9573,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9588,15 +9582,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9972,6 +9965,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9980,15 +9974,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10080,6 +10073,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10088,15 +10082,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10180,6 +10173,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10188,15 +10182,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10280,6 +10273,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10288,15 +10282,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10401,6 +10394,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10409,15 +10403,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10568,6 +10561,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10576,15 +10570,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10686,6 +10679,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10694,15 +10688,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10993,6 +10986,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11001,15 +10995,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11175,6 +11168,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11183,15 +11177,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11343,6 +11336,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11351,18 +11345,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11696,6 +11686,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11704,15 +11695,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11888,6 +11878,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11896,11 +11887,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12059,6 +12053,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12067,18 +12062,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12237,6 +12228,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12245,15 +12237,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12429,6 +12420,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12437,15 +12429,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13003,6 +12994,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13011,15 +13003,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13215,6 +13206,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13223,15 +13215,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13404,6 +13395,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13412,15 +13404,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13593,6 +13584,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13601,15 +13593,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13785,6 +13776,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13793,15 +13785,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13980,6 +13971,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13988,15 +13980,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14169,6 +14160,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14177,15 +14169,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14362,6 +14353,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14370,15 +14362,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14764,6 +14755,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14772,15 +14764,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14958,6 +14949,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14966,18 +14958,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15240,6 +15228,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15248,15 +15237,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15342,6 +15330,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15350,15 +15339,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15448,6 +15436,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15456,15 +15445,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15654,6 +15642,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15662,15 +15651,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15838,6 +15826,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15846,15 +15835,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15947,6 +15935,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15955,15 +15944,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16074,6 +16062,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16082,15 +16071,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16266,6 +16254,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16274,18 +16263,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16616,6 +16601,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16624,15 +16610,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16737,6 +16722,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16745,15 +16731,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16845,6 +16830,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16853,15 +16839,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16953,6 +16938,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16961,15 +16947,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17062,6 +17047,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17070,15 +17056,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17187,6 +17172,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17195,15 +17181,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17404,6 +17389,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17412,15 +17398,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17581,6 +17566,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17589,15 +17575,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17931,6 +17916,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17939,18 +17925,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18160,6 +18142,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18168,18 +18151,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18455,6 +18434,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18463,18 +18443,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18713,6 +18689,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18721,18 +18698,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18948,6 +18921,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18956,18 +18930,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19248,6 +19218,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19256,18 +19227,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19496,6 +19463,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19504,18 +19472,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19759,6 +19723,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19767,18 +19732,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19995,6 +19956,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20003,18 +19965,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20297,6 +20255,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20305,18 +20264,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20540,6 +20495,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20548,15 +20504,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20724,6 +20679,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20732,15 +20688,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20950,6 +20905,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20958,18 +20914,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21224,6 +21176,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21232,15 +21185,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21402,6 +21354,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21410,15 +21363,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21541,6 +21493,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21549,15 +21502,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21729,6 +21681,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21737,15 +21690,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21961,6 +21913,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21969,18 +21922,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22235,6 +22184,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22243,15 +22193,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22413,6 +22362,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22421,15 +22371,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py index b8f18946e159..1b2efd4ad529 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1086,11 +1088,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1648,11 +1646,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2115,6 +2109,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2123,15 +2118,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2313,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,11 +2322,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2502,6 +2500,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2510,18 +2509,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3019,6 +3014,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3027,15 +3023,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3229,6 +3224,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3237,11 +3233,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3419,6 +3418,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3427,18 +3427,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4205,6 +4201,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4213,15 +4210,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4403,6 +4399,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4411,15 +4408,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4598,6 +4594,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4606,15 +4603,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4772,6 +4768,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4780,18 +4777,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4993,6 +4986,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5001,15 +4995,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5100,6 +5093,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5108,15 +5102,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5504,6 +5497,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5512,15 +5506,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5612,6 +5605,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5620,15 +5614,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5712,6 +5705,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5720,15 +5714,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5812,6 +5805,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5820,15 +5814,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5912,6 +5905,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5920,15 +5914,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6033,6 +6026,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6041,15 +6035,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6202,6 +6195,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6210,15 +6204,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6323,6 +6316,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6331,15 +6325,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6634,6 +6627,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6642,15 +6636,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6816,6 +6809,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6824,15 +6818,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6984,6 +6977,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6992,18 +6986,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7337,6 +7327,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7345,15 +7336,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7529,6 +7519,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7537,11 +7528,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7702,6 +7696,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7710,18 +7705,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7884,6 +7875,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7892,15 +7884,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8076,6 +8067,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8084,15 +8076,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8650,6 +8641,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8658,15 +8650,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8862,6 +8853,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8870,15 +8862,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9051,6 +9042,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9059,15 +9051,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9240,6 +9231,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9248,15 +9240,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9432,6 +9423,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9440,15 +9432,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9627,6 +9618,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9635,15 +9627,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9816,6 +9807,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9824,15 +9816,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10009,6 +10000,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10017,15 +10009,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10411,6 +10402,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10419,15 +10411,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10622,6 +10613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10630,15 +10622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10817,6 +10808,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10825,18 +10817,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11101,6 +11089,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11109,15 +11098,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11205,6 +11193,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11213,15 +11202,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11311,6 +11299,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11319,15 +11308,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11514,6 +11502,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11522,15 +11511,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11733,6 +11721,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11741,11 +11730,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11931,6 +11923,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11939,18 +11932,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12228,6 +12217,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12236,15 +12226,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12412,6 +12401,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12420,15 +12410,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12521,6 +12510,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12529,15 +12519,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12648,6 +12637,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12656,15 +12646,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12840,6 +12829,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12848,18 +12838,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13190,6 +13176,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13198,15 +13185,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13311,6 +13297,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13319,15 +13306,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13419,6 +13405,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13427,15 +13414,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13527,6 +13513,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13535,15 +13522,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13636,6 +13622,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13644,15 +13631,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13762,6 +13748,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13770,15 +13757,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13982,6 +13968,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13990,15 +13977,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14160,6 +14146,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14168,15 +14155,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14357,6 +14343,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14365,15 +14352,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14541,6 +14527,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14549,15 +14536,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14767,6 +14753,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14775,18 +14762,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15041,6 +15024,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15049,15 +15033,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15224,6 +15207,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15232,15 +15216,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15365,6 +15348,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15373,15 +15357,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15556,6 +15539,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15564,15 +15548,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15793,6 +15776,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15801,18 +15785,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16069,6 +16049,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16077,15 +16058,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16252,6 +16232,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16260,15 +16241,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16397,6 +16377,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16405,15 +16386,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16598,6 +16578,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16606,15 +16587,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16842,6 +16822,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16850,18 +16831,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17139,6 +17116,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17147,18 +17125,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17335,6 +17309,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17343,11 +17318,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17562,6 +17540,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17570,18 +17549,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17857,6 +17832,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17865,18 +17841,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18072,6 +18044,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18080,11 +18053,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18321,6 +18297,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18329,18 +18306,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18557,6 +18530,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18565,18 +18539,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18794,6 +18764,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18802,11 +18773,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19087,6 +19061,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19095,18 +19070,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19335,6 +19306,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19343,18 +19315,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19554,6 +19522,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19562,11 +19531,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19810,6 +19782,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19818,18 +19791,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20047,6 +20016,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20055,18 +20025,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20286,6 +20252,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20294,11 +20261,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20581,6 +20551,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20589,18 +20560,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py index 6980be991301..fa54f4f6c607 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6255,11 +6257,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6817,11 +6815,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7280,6 +7274,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7288,15 +7283,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7481,6 +7475,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7489,11 +7484,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7661,6 +7659,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7669,18 +7668,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8177,6 +8172,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8185,15 +8181,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8387,6 +8382,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8395,11 +8391,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8577,6 +8576,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8585,18 +8585,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9362,6 +9358,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9370,15 +9367,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9560,6 +9556,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9568,15 +9565,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9752,6 +9748,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9760,15 +9757,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9923,6 +9919,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9931,18 +9928,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10144,6 +10137,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10152,15 +10146,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10249,6 +10242,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10257,15 +10251,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10650,6 +10643,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10658,15 +10652,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10758,6 +10751,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10766,15 +10760,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10858,6 +10851,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10866,15 +10860,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10958,6 +10951,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10966,15 +10960,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11058,6 +11051,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11066,15 +11060,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11179,6 +11172,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11187,15 +11181,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11346,6 +11339,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11354,15 +11348,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11465,6 +11458,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11473,15 +11467,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11772,6 +11765,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11780,15 +11774,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11954,6 +11947,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11962,15 +11956,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12122,6 +12115,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12130,18 +12124,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12475,6 +12465,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12483,15 +12474,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12667,6 +12657,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12675,11 +12666,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12838,6 +12832,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12846,18 +12841,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13016,6 +13007,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13024,15 +13016,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13208,6 +13199,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13216,15 +13208,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13782,6 +13773,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13790,15 +13782,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13994,6 +13985,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14002,15 +13994,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14183,6 +14174,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14191,15 +14183,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14372,6 +14363,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14380,15 +14372,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14564,6 +14555,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14572,15 +14564,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14759,6 +14750,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14767,15 +14759,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14948,6 +14939,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14956,15 +14948,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15141,6 +15132,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15149,15 +15141,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15543,6 +15534,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15551,15 +15543,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15754,6 +15745,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15762,15 +15754,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15949,6 +15940,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15957,18 +15949,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16231,6 +16219,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16239,15 +16228,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16333,6 +16321,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16341,15 +16330,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16439,6 +16427,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16447,15 +16436,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16642,6 +16630,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16650,15 +16639,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16861,6 +16849,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16869,11 +16858,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17059,6 +17051,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17067,18 +17060,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17356,6 +17345,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17364,15 +17354,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17540,6 +17529,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17548,15 +17538,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17649,6 +17638,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17657,15 +17647,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17776,6 +17765,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17784,15 +17774,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17968,6 +17957,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17976,18 +17966,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18318,6 +18304,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18326,15 +18313,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18439,6 +18425,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18447,15 +18434,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18547,6 +18533,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18555,15 +18542,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18655,6 +18641,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18663,15 +18650,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18764,6 +18750,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18772,15 +18759,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18890,6 +18876,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18898,15 +18885,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19107,6 +19093,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19115,15 +19102,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19284,6 +19270,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19292,15 +19279,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19480,6 +19466,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19488,15 +19475,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19664,6 +19650,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19672,15 +19659,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19890,6 +19876,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19898,18 +19885,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20164,6 +20147,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20172,15 +20156,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20342,6 +20325,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20350,15 +20334,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20481,6 +20464,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20489,15 +20473,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20669,6 +20652,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20677,15 +20661,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20901,6 +20884,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20909,18 +20893,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21175,6 +21155,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21183,15 +21164,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21353,6 +21333,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21361,15 +21342,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21496,6 +21476,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21504,15 +21485,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21694,6 +21674,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21702,15 +21683,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21933,6 +21913,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21941,18 +21922,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22224,6 +22201,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22232,18 +22210,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22417,6 +22391,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22425,11 +22400,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22641,6 +22619,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22649,18 +22628,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22936,6 +22911,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22944,18 +22920,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23151,6 +23123,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23159,11 +23132,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23400,6 +23376,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23408,18 +23385,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23635,6 +23608,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23643,18 +23617,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23872,6 +23842,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23880,11 +23851,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24165,6 +24139,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24173,18 +24148,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24413,6 +24384,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24421,18 +24393,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24632,6 +24600,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24640,11 +24609,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24888,6 +24860,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24896,18 +24869,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25124,6 +25093,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25132,18 +25102,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25363,6 +25329,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25371,11 +25338,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25658,6 +25628,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25666,18 +25637,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_operations.py index b5a945b7db9d..1636ed5b5bcb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -122,6 +124,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -130,15 +133,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -306,6 +308,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -314,15 +317,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -532,6 +534,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -540,18 +543,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -806,6 +805,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -814,15 +814,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -989,6 +988,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -997,15 +997,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1130,6 +1129,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1138,15 +1138,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1321,6 +1320,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1329,15 +1329,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1558,6 +1557,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1566,18 +1566,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1834,6 +1830,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1842,15 +1839,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2017,6 +2013,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2025,15 +2022,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,6 +2158,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2170,15 +2167,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2363,6 +2359,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2371,15 +2368,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2607,6 +2603,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2615,18 +2612,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_operations.py index fda7762aa94e..214ff1f13ade 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -759,6 +761,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -767,15 +770,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -943,6 +945,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -951,15 +954,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1169,6 +1171,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1177,18 +1180,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1443,6 +1442,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1451,15 +1451,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1621,6 +1620,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1629,15 +1629,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1760,6 +1759,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1768,15 +1768,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1948,6 +1947,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1956,15 +1956,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2180,6 +2179,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2188,18 +2188,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2454,6 +2450,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2462,15 +2459,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2632,6 +2628,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2640,15 +2637,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2775,6 +2771,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2783,15 +2780,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2973,6 +2969,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2981,15 +2978,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3212,6 +3208,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3220,18 +3217,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py index 97915c1c9223..38c5bff092ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1074,11 +1076,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1636,11 +1634,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2103,6 +2097,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2111,15 +2106,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2307,6 +2301,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2315,11 +2310,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2490,6 +2488,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2498,18 +2497,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3026,11 +3021,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3612,6 +3603,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3620,15 +3612,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3822,6 +3813,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3830,11 +3822,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4012,6 +4007,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4020,18 +4016,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4798,6 +4790,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4806,15 +4799,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4996,6 +4988,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5004,15 +4997,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5191,6 +5183,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5199,15 +5192,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5365,6 +5357,7 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5373,18 +5366,14 @@ async def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5586,6 +5575,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5594,15 +5584,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5693,6 +5682,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5701,15 +5691,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6097,6 +6086,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6105,15 +6095,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6205,6 +6194,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6213,15 +6203,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6305,6 +6294,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6313,15 +6303,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6405,6 +6394,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6413,15 +6403,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6505,6 +6494,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6513,15 +6503,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6626,6 +6615,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6634,15 +6624,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6795,6 +6784,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6803,15 +6793,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6969,6 +6958,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6977,15 +6967,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7280,6 +7269,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7288,15 +7278,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7462,6 +7451,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7470,15 +7460,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7630,6 +7619,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7638,18 +7628,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7983,6 +7969,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7991,15 +7978,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8175,6 +8161,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8183,11 +8170,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8348,6 +8338,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8356,18 +8347,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8530,6 +8517,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8538,15 +8526,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8722,6 +8709,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8730,15 +8718,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9296,6 +9283,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9304,15 +9292,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9508,6 +9495,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9516,15 +9504,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9697,6 +9684,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9705,15 +9693,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9886,6 +9873,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9894,15 +9882,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10078,6 +10065,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10086,15 +10074,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10273,6 +10260,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10281,15 +10269,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10462,6 +10449,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10470,15 +10458,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10655,6 +10642,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10663,15 +10651,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11034,6 +11021,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11042,15 +11030,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11243,6 +11230,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11251,15 +11239,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11454,6 +11441,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11462,15 +11450,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11649,6 +11636,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11657,18 +11645,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11933,6 +11917,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11941,15 +11926,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12037,6 +12021,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12045,15 +12030,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12143,6 +12127,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12151,15 +12136,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12346,6 +12330,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12354,15 +12339,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12565,6 +12549,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12573,11 +12558,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12763,6 +12751,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12771,18 +12760,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13060,6 +13045,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13068,15 +13054,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13244,6 +13229,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13252,15 +13238,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13353,6 +13338,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13361,15 +13347,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13480,6 +13465,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13488,15 +13474,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13672,6 +13657,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13680,18 +13666,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14022,6 +14004,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14030,15 +14013,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14143,6 +14125,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14151,15 +14134,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14251,6 +14233,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14259,15 +14242,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14359,6 +14341,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14367,15 +14350,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14468,6 +14450,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14476,15 +14459,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14650,6 +14632,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14658,15 +14641,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14870,6 +14852,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14878,15 +14861,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15048,6 +15030,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15056,15 +15039,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15399,6 +15381,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15407,18 +15390,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15595,6 +15574,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15603,11 +15583,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15822,6 +15805,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15830,18 +15814,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16117,6 +16097,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16125,18 +16106,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16332,6 +16309,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16340,11 +16318,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16581,6 +16562,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16589,18 +16571,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16817,6 +16795,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16825,18 +16804,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17054,6 +17029,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17062,11 +17038,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17347,6 +17326,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17355,18 +17335,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17595,6 +17571,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17603,18 +17580,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17814,6 +17787,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17822,11 +17796,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18070,6 +18047,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18078,18 +18056,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18307,6 +18281,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18315,18 +18290,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18546,6 +18517,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18554,11 +18526,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18841,6 +18816,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18849,18 +18825,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py index 635e6d5d4026..8a996bfa14a1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -5890,11 +5892,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6452,11 +6450,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6915,6 +6909,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6923,15 +6918,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7116,6 +7110,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7124,11 +7119,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7296,6 +7294,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7304,18 +7303,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7831,11 +7826,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8415,6 +8406,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8423,15 +8415,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8625,6 +8616,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8633,11 +8625,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8815,6 +8810,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8823,18 +8819,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9600,6 +9592,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9608,15 +9601,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9798,6 +9790,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9806,15 +9799,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9990,6 +9982,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9998,15 +9991,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10161,6 +10153,7 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10169,18 +10162,14 @@ def _delete_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10382,6 +10371,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10390,15 +10380,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10487,6 +10476,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10495,15 +10485,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10888,6 +10877,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10896,15 +10886,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10996,6 +10985,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11004,15 +10994,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11096,6 +11085,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11104,15 +11094,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11196,6 +11185,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11204,15 +11194,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11296,6 +11285,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11304,15 +11294,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11417,6 +11406,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11425,15 +11415,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11584,6 +11573,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11592,15 +11582,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11756,6 +11745,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11764,15 +11754,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12063,6 +12052,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12071,15 +12061,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12245,6 +12234,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12253,15 +12243,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12413,6 +12402,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12421,18 +12411,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12766,6 +12752,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12774,15 +12761,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12958,6 +12944,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12966,11 +12953,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13129,6 +13119,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13137,18 +13128,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13307,6 +13294,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13315,15 +13303,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13499,6 +13486,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13507,15 +13495,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14073,6 +14060,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14081,15 +14069,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14285,6 +14272,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14293,15 +14281,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14474,6 +14461,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14482,15 +14470,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14663,6 +14650,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14671,15 +14659,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14855,6 +14842,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14863,15 +14851,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15050,6 +15037,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15058,15 +15046,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15239,6 +15226,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15247,15 +15235,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15432,6 +15419,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15440,15 +15428,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15811,6 +15798,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15819,15 +15807,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16020,6 +16007,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16028,15 +16016,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16231,6 +16218,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16239,15 +16227,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16426,6 +16413,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16434,18 +16422,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16708,6 +16692,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16716,15 +16701,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16810,6 +16794,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16818,15 +16803,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16916,6 +16900,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16924,15 +16909,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17119,6 +17103,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17127,15 +17112,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17338,6 +17322,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17346,11 +17331,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17536,6 +17524,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17544,18 +17533,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17833,6 +17818,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17841,15 +17827,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18017,6 +18002,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18025,15 +18011,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18126,6 +18111,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18134,15 +18120,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18253,6 +18238,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18261,15 +18247,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18445,6 +18430,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18453,18 +18439,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18795,6 +18777,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18803,15 +18786,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18916,6 +18898,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18924,15 +18907,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19024,6 +19006,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19032,15 +19015,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19132,6 +19114,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19140,15 +19123,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19241,6 +19223,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19249,15 +19232,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19423,6 +19405,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19431,15 +19414,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19640,6 +19622,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19648,15 +19631,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19817,6 +19799,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19825,15 +19808,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20167,6 +20149,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20175,18 +20158,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20360,6 +20339,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20368,11 +20348,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20584,6 +20567,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20592,18 +20576,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20879,6 +20859,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20887,18 +20868,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21094,6 +21071,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21102,11 +21080,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21343,6 +21324,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21351,18 +21333,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21578,6 +21556,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21586,18 +21565,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21815,6 +21790,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21823,11 +21799,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22108,6 +22087,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22116,18 +22096,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22356,6 +22332,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22364,18 +22341,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22575,6 +22548,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22583,11 +22557,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22831,6 +22808,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22839,18 +22817,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23067,6 +23041,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23075,18 +23050,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23306,6 +23277,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23314,11 +23286,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23601,6 +23576,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23609,18 +23585,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py index 11fb36e9da60..35be4b8438f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -129,6 +131,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -137,15 +140,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,6 +315,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -321,15 +324,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -539,6 +541,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -547,18 +550,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -813,6 +812,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -821,15 +821,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -996,6 +995,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1004,15 +1004,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1137,6 +1136,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1145,15 +1145,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1328,6 +1327,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1336,15 +1336,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1565,6 +1564,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1573,18 +1573,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1841,6 +1837,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1849,15 +1846,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2024,6 +2020,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2032,15 +2029,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2169,6 +2165,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2177,15 +2174,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2370,6 +2366,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2378,15 +2375,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2614,6 +2610,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2622,18 +2619,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2915,6 +2908,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2923,15 +2917,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3112,6 +3105,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3120,15 +3114,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3349,6 +3342,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3357,18 +3351,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py index 1a3a42ffda1f..78cf9763a47a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -974,6 +976,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -982,15 +985,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1158,6 +1160,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1166,15 +1169,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1384,6 +1386,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1392,18 +1395,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1658,6 +1657,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1666,15 +1666,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1836,6 +1835,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1844,15 +1844,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1975,6 +1974,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1983,15 +1983,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2163,6 +2162,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2171,15 +2171,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2395,6 +2394,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2403,18 +2403,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2669,6 +2665,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2677,15 +2674,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2847,6 +2843,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2855,15 +2852,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2990,6 +2986,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2998,15 +2995,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3188,6 +3184,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3196,15 +3193,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3427,6 +3423,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3435,18 +3432,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3722,6 +3715,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3730,15 +3724,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3916,6 +3909,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3924,15 +3918,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4148,6 +4141,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4156,18 +4150,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py index e0ea75ba46a2..a6a669a3ac26 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1061,11 +1063,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1623,11 +1621,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,6 +2096,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2110,15 +2105,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2306,6 +2300,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2314,11 +2309,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2489,6 +2487,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2497,18 +2496,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3025,11 +3020,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3611,6 +3602,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3619,15 +3611,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3821,6 +3812,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3829,11 +3821,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4011,6 +4006,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4019,18 +4015,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4797,6 +4789,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4805,15 +4798,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4995,6 +4987,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5003,15 +4996,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5190,6 +5182,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5198,15 +5191,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5367,6 +5359,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5375,18 +5368,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5594,6 +5583,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5602,15 +5592,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5697,6 +5686,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5705,15 +5695,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6101,6 +6090,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6109,15 +6099,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6209,6 +6198,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6217,15 +6207,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6309,6 +6298,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6317,15 +6307,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6409,6 +6398,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6417,15 +6407,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6509,6 +6498,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6517,15 +6507,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6630,6 +6619,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6638,15 +6628,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6866,6 +6855,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6874,15 +6864,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7022,6 +7011,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7030,15 +7020,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7150,6 +7139,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7158,15 +7148,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7461,6 +7450,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7469,15 +7459,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7643,6 +7632,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7651,15 +7641,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7811,6 +7800,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7819,18 +7809,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8164,6 +8150,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8172,15 +8159,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8356,6 +8342,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8364,11 +8351,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8529,6 +8519,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8537,18 +8528,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8711,6 +8698,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8719,15 +8707,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8903,6 +8890,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8911,15 +8899,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9477,6 +9464,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9485,15 +9473,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9689,6 +9676,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9697,15 +9685,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9878,6 +9865,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9886,15 +9874,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10067,6 +10054,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10075,15 +10063,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10259,6 +10246,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10267,15 +10255,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10454,6 +10441,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10462,15 +10450,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10643,6 +10630,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10651,15 +10639,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10836,6 +10823,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10844,15 +10832,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11215,6 +11202,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11223,15 +11211,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11424,6 +11411,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11432,15 +11420,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11635,6 +11622,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11643,15 +11631,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11830,6 +11817,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11838,18 +11826,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12114,6 +12098,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12122,15 +12107,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12218,6 +12202,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12226,15 +12211,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12324,6 +12308,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12332,15 +12317,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12527,6 +12511,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12535,15 +12520,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12747,6 +12731,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12755,11 +12740,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12946,6 +12934,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12954,18 +12943,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13245,6 +13230,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13253,15 +13239,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13429,6 +13414,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13437,15 +13423,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13538,6 +13523,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13546,15 +13532,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13665,6 +13650,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13673,15 +13659,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13857,6 +13842,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13865,18 +13851,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14207,6 +14189,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14215,15 +14198,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14328,6 +14310,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14336,15 +14319,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14436,6 +14418,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14444,15 +14427,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14544,6 +14526,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14552,15 +14535,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14725,6 +14707,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14733,15 +14716,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14905,6 +14887,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14913,15 +14896,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15125,6 +15107,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15133,15 +15116,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15303,6 +15285,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15311,15 +15294,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15639,6 +15621,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15647,15 +15630,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15848,6 +15830,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15856,11 +15839,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16037,6 +16023,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16045,18 +16032,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16344,6 +16327,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16352,15 +16336,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16562,6 +16545,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16570,11 +16554,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16759,6 +16746,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16767,18 +16755,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py index 3f99e1b157be..09cc1df41981 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -5484,11 +5486,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6046,11 +6044,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6521,6 +6515,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6529,15 +6524,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6722,6 +6716,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6730,11 +6725,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6902,6 +6900,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6910,18 +6909,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7437,11 +7432,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8021,6 +8012,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8029,15 +8021,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8231,6 +8222,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8239,11 +8231,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8421,6 +8416,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8429,18 +8425,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9206,6 +9198,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9214,15 +9207,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9404,6 +9396,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9412,15 +9405,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9596,6 +9588,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9604,15 +9597,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9770,6 +9762,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9778,18 +9771,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9997,6 +9986,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10005,15 +9995,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10098,6 +10087,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10106,15 +10096,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10499,6 +10488,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10507,15 +10497,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10607,6 +10596,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10615,15 +10605,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10707,6 +10696,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10715,15 +10705,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10807,6 +10796,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10815,15 +10805,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10907,6 +10896,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10915,15 +10905,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11028,6 +11017,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11036,15 +11026,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11262,6 +11251,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11270,15 +11260,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11414,6 +11403,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11422,15 +11412,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11542,6 +11531,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11550,15 +11540,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11849,6 +11838,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11857,15 +11847,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12031,6 +12020,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12039,15 +12029,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12199,6 +12188,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12207,18 +12197,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12552,6 +12538,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12560,15 +12547,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12744,6 +12730,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12752,11 +12739,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12915,6 +12905,7 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12923,18 +12914,14 @@ def _delete_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13093,6 +13080,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13101,15 +13089,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13285,6 +13272,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13293,15 +13281,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13859,6 +13846,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13867,15 +13855,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14071,6 +14058,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14079,15 +14067,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14260,6 +14247,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14268,15 +14256,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14449,6 +14436,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14457,15 +14445,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14641,6 +14628,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14649,15 +14637,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14836,6 +14823,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14844,15 +14832,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15025,6 +15012,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15033,15 +15021,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15218,6 +15205,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15226,15 +15214,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15597,6 +15584,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15605,15 +15593,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15806,6 +15793,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15814,15 +15802,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16017,6 +16004,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16025,15 +16013,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16212,6 +16199,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16220,18 +16208,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16494,6 +16478,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16502,15 +16487,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16596,6 +16580,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16604,15 +16589,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16702,6 +16686,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16710,15 +16695,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16905,6 +16889,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16913,15 +16898,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17125,6 +17109,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17133,11 +17118,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17324,6 +17312,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17332,18 +17321,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17623,6 +17608,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17631,15 +17617,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17807,6 +17792,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17815,15 +17801,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17916,6 +17901,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17924,15 +17910,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18043,6 +18028,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18051,15 +18037,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18235,6 +18220,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18243,18 +18229,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18585,6 +18567,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18593,15 +18576,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18706,6 +18688,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18714,15 +18697,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18814,6 +18796,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18822,15 +18805,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18922,6 +18904,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18930,15 +18913,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19103,6 +19085,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19111,15 +19094,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19283,6 +19265,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19291,15 +19274,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19500,6 +19482,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19508,15 +19491,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19677,6 +19659,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19685,15 +19668,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20012,6 +19994,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20020,15 +20003,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20221,6 +20203,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20229,11 +20212,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20410,6 +20396,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20418,18 +20405,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20717,6 +20700,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20725,15 +20709,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20935,6 +20918,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20943,11 +20927,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21132,6 +21119,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21140,18 +21128,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_operations.py index 0084d434ad15..4ec0fefb2d66 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -130,6 +132,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -138,15 +141,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -314,6 +316,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -322,15 +325,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -540,6 +542,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -548,18 +551,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -814,6 +813,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -822,15 +822,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -997,6 +996,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1005,15 +1005,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1138,6 +1137,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1146,15 +1146,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1329,6 +1328,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1337,15 +1337,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1566,6 +1565,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1574,18 +1574,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1842,6 +1838,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1850,15 +1847,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2025,6 +2021,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2033,15 +2030,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2170,6 +2166,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2178,15 +2175,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2371,6 +2367,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2379,15 +2376,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2615,6 +2611,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2623,18 +2620,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3000,6 +2993,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3008,15 +3002,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3197,6 +3190,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3205,15 +3199,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3434,6 +3427,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3442,18 +3436,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_operations.py index 72cb8433a98f..2907a9dbf863 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1005,6 +1007,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1016,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1189,6 +1191,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1197,15 +1200,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1415,6 +1417,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1423,18 +1426,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1689,6 +1688,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1697,15 +1697,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1867,6 +1866,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1875,15 +1875,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2006,6 +2005,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2014,15 +2014,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2194,6 +2193,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2202,15 +2202,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2426,6 +2425,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2434,18 +2434,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2700,6 +2696,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2708,15 +2705,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2878,6 +2874,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2886,15 +2883,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3021,6 +3017,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3029,15 +3026,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3219,6 +3215,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3227,15 +3224,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3458,6 +3454,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3466,18 +3463,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3837,6 +3830,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3845,15 +3839,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4031,6 +4024,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4039,15 +4033,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4263,6 +4256,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4271,18 +4265,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_operations.py index 70c169e3b529..2e287b5a63f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -169,6 +171,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -177,15 +180,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -353,6 +355,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -361,15 +364,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -579,6 +581,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -587,18 +590,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -853,6 +852,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -861,15 +861,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1036,6 +1035,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1044,15 +1044,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1177,6 +1176,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1185,15 +1185,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1368,6 +1367,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1376,15 +1376,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1605,6 +1604,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1613,18 +1613,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1881,6 +1877,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1889,15 +1886,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2064,6 +2060,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2072,15 +2069,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2209,6 +2205,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2217,15 +2214,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2410,6 +2406,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2418,15 +2415,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2654,6 +2650,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2662,18 +2659,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3039,6 +3032,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3047,15 +3041,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3236,6 +3229,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3244,15 +3238,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3473,6 +3466,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3481,18 +3475,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3811,6 +3801,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3819,15 +3810,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4073,6 +4063,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4081,18 +4072,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4488,6 +4475,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4496,18 +4484,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4684,6 +4668,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4692,11 +4677,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4922,6 +4910,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4930,18 +4919,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5217,6 +5202,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5225,18 +5211,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5432,6 +5414,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5440,11 +5423,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5681,6 +5667,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5689,18 +5676,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5917,6 +5900,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5925,18 +5909,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6154,6 +6134,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6162,11 +6143,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6447,6 +6431,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6455,18 +6440,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6695,6 +6676,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6703,18 +6685,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6914,6 +6892,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6922,11 +6901,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7170,6 +7152,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7178,18 +7161,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7407,6 +7386,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7415,18 +7395,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7646,6 +7622,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7654,11 +7631,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7941,6 +7921,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7949,18 +7930,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8188,6 +8165,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8196,15 +8174,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_operations.py index 8893c8c30a99..2909ed83368c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -2397,6 +2399,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2405,15 +2408,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2581,6 +2583,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2589,15 +2592,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2807,6 +2809,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2815,18 +2818,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3081,6 +3080,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3089,15 +3089,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3259,6 +3258,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3267,15 +3267,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3398,6 +3397,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3406,15 +3406,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3586,6 +3585,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3594,15 +3594,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3818,6 +3817,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3826,18 +3826,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4092,6 +4088,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4100,15 +4097,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4270,6 +4266,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4278,15 +4275,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4413,6 +4409,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4421,15 +4418,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4611,6 +4607,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4619,15 +4616,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4850,6 +4846,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4858,18 +4855,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5229,6 +5222,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5237,15 +5231,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5423,6 +5416,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5431,15 +5425,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5655,6 +5648,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5663,18 +5657,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5989,6 +5979,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5997,15 +5988,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6251,6 +6241,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6259,18 +6250,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6665,6 +6652,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6673,18 +6661,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6858,6 +6842,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6866,11 +6851,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7093,6 +7081,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7101,18 +7090,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7388,6 +7373,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7396,18 +7382,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7603,6 +7585,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7611,11 +7594,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7852,6 +7838,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7860,18 +7847,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8087,6 +8070,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8095,18 +8079,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8324,6 +8304,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8332,11 +8313,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8617,6 +8601,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8625,18 +8610,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8865,6 +8846,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8873,18 +8855,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9084,6 +9062,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9092,11 +9071,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9340,6 +9322,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9348,18 +9331,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9576,6 +9555,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9584,18 +9564,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9815,6 +9791,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9823,11 +9800,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10110,6 +10090,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10118,18 +10099,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10357,6 +10334,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10365,15 +10343,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_operations.py index 0e6c66c21161..34d08d3b1829 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -131,6 +133,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -139,18 +142,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -474,6 +473,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -482,15 +482,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -587,6 +586,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -595,15 +595,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -700,6 +699,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -708,15 +708,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -827,6 +826,7 @@ async def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -835,11 +835,14 @@ async def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1083,6 +1086,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1091,15 +1095,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1285,6 +1288,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1293,11 +1297,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1462,6 +1469,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1470,18 +1478,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1848,6 +1852,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1856,15 +1861,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1956,6 +1960,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1964,15 +1969,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2084,6 +2088,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2092,15 +2097,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2273,6 +2277,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2281,15 +2286,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2465,6 +2469,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2473,15 +2478,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2660,6 +2664,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2668,15 +2673,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2872,6 +2876,7 @@ async def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2880,15 +2885,14 @@ async def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_operations.py index 9bd73d48f241..a851a4d48bfa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -934,6 +936,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -942,18 +945,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1277,6 +1276,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1285,15 +1285,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1390,6 +1389,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1398,15 +1398,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1503,6 +1502,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1511,15 +1511,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1630,6 +1629,7 @@ def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1638,11 +1638,14 @@ def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1886,6 +1889,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1894,15 +1898,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2088,6 +2091,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2096,11 +2100,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2263,6 +2270,7 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2271,18 +2279,14 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2645,6 +2649,7 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2653,15 +2658,14 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2749,6 +2753,7 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2757,15 +2762,14 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2875,6 +2879,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2883,15 +2888,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3064,6 +3068,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3072,15 +3077,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3256,6 +3260,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3264,15 +3269,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3451,6 +3455,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3459,15 +3464,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3663,6 +3667,7 @@ def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3671,15 +3676,14 @@ def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py index c72b972dc796..465db8bd41bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py @@ -33,6 +33,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -303,6 +305,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -311,15 +314,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -487,6 +489,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -495,15 +498,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,6 +715,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -721,18 +724,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -987,6 +986,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -995,15 +995,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1170,6 +1169,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1178,15 +1178,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1311,6 +1310,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1319,15 +1319,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1502,6 +1501,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1510,15 +1510,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1739,6 +1738,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1747,18 +1747,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2015,6 +2011,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2023,15 +2020,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2198,6 +2194,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2206,15 +2203,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2343,6 +2339,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2351,15 +2348,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2544,6 +2540,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2552,15 +2549,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2788,6 +2784,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2796,18 +2793,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3173,6 +3166,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3181,15 +3175,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3370,6 +3363,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3378,15 +3372,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3607,6 +3600,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3615,18 +3609,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3945,6 +3935,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3953,15 +3944,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4207,6 +4197,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4215,18 +4206,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4609,6 +4596,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4617,15 +4605,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4831,6 +4818,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4839,15 +4827,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5790,11 +5777,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6352,11 +6335,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6831,6 +6810,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6839,15 +6819,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7035,6 +7014,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7043,11 +7023,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7218,6 +7201,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7226,18 +7210,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7754,11 +7734,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8340,6 +8316,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8348,15 +8325,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8550,6 +8526,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8558,11 +8535,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8740,6 +8720,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8748,18 +8729,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9881,6 +9858,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9889,15 +9867,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10079,6 +10056,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10087,15 +10065,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10274,6 +10251,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10282,11 +10260,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10447,6 +10428,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10455,18 +10437,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10674,6 +10652,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10682,15 +10661,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10777,6 +10755,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10785,15 +10764,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11181,6 +11159,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11189,15 +11168,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11289,6 +11267,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11297,15 +11276,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11389,6 +11367,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11397,15 +11376,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11489,6 +11467,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11497,15 +11476,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11589,6 +11567,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11597,15 +11576,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11710,6 +11688,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11718,15 +11697,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11946,6 +11924,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11954,15 +11933,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12102,6 +12080,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12110,15 +12089,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12230,6 +12208,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12238,15 +12217,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12428,6 +12406,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12436,15 +12415,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12723,6 +12701,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12731,15 +12710,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12915,6 +12893,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12923,11 +12902,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13089,6 +13071,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13097,18 +13080,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13275,6 +13254,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13283,15 +13263,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13470,6 +13449,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13478,15 +13458,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14058,6 +14037,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14066,15 +14046,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14270,6 +14249,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14278,15 +14258,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14459,6 +14438,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14467,15 +14447,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14648,6 +14627,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14656,15 +14636,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14840,6 +14819,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14848,15 +14828,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15035,6 +15014,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15043,15 +15023,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15224,6 +15203,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15232,15 +15212,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15417,6 +15396,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15425,15 +15405,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15796,6 +15775,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15804,15 +15784,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16099,6 +16078,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16107,15 +16087,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16281,6 +16260,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16289,15 +16269,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16449,6 +16428,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16457,18 +16437,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16804,6 +16780,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16812,15 +16789,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17015,6 +16991,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17023,15 +17000,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17210,6 +17186,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17218,18 +17195,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17494,6 +17467,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17502,15 +17476,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17598,6 +17571,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17606,15 +17580,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17704,6 +17677,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17712,15 +17686,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17907,6 +17880,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17915,15 +17889,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18127,6 +18100,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18135,11 +18109,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18326,6 +18303,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18334,18 +18312,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18625,6 +18599,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18633,15 +18608,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18809,6 +18783,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18817,15 +18792,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18918,6 +18892,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18926,15 +18901,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19045,6 +19019,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19053,15 +19028,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19244,6 +19218,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19252,18 +19227,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19604,6 +19575,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19612,15 +19584,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19725,6 +19696,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19733,15 +19705,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19833,6 +19804,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19841,15 +19813,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19941,6 +19912,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19949,15 +19921,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20122,6 +20093,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20130,15 +20102,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20302,6 +20273,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20310,15 +20282,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20522,6 +20493,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20530,15 +20502,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20700,6 +20671,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20708,15 +20680,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21036,6 +21007,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21044,15 +21016,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21245,6 +21216,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21253,11 +21225,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21434,6 +21409,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21442,18 +21418,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21741,6 +21713,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21749,15 +21722,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21959,6 +21931,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21967,11 +21940,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22156,6 +22132,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22164,18 +22141,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py index a9fca700754e..716356e557fc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6171,6 +6173,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6179,15 +6182,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6355,6 +6357,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6363,15 +6366,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6581,6 +6583,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6589,18 +6592,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6855,6 +6854,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6863,15 +6863,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7033,6 +7032,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7041,15 +7041,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7172,6 +7171,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7180,15 +7180,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7360,6 +7359,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7368,15 +7368,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7592,6 +7591,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7600,18 +7600,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7866,6 +7862,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7874,15 +7871,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8044,6 +8040,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8052,15 +8049,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8187,6 +8183,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8195,15 +8192,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8385,6 +8381,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8393,15 +8390,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8624,6 +8620,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8632,18 +8629,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9003,6 +8996,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9011,15 +9005,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9197,6 +9190,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9205,15 +9199,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9429,6 +9422,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9437,18 +9431,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9763,6 +9753,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9771,15 +9762,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10025,6 +10015,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10033,18 +10024,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10426,6 +10413,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10434,15 +10422,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10645,6 +10632,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10653,15 +10641,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11601,11 +11588,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12163,11 +12146,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12638,6 +12617,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12646,15 +12626,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12839,6 +12818,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12847,11 +12827,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13019,6 +13002,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13027,18 +13011,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13554,11 +13534,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14138,6 +14114,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14146,15 +14123,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14348,6 +14324,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14356,11 +14333,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14538,6 +14518,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14546,18 +14527,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15678,6 +15655,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15686,15 +15664,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15876,6 +15853,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15884,15 +15862,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16068,6 +16045,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16076,11 +16054,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16238,6 +16219,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16246,18 +16228,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16465,6 +16443,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16473,15 +16452,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16566,6 +16544,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16574,15 +16553,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16967,6 +16945,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16975,15 +16954,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17075,6 +17053,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17083,15 +17062,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17175,6 +17153,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17183,15 +17162,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17275,6 +17253,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17283,15 +17262,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17375,6 +17353,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17383,15 +17362,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17496,6 +17474,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17504,15 +17483,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17730,6 +17708,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17738,15 +17717,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17882,6 +17860,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17890,15 +17869,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18010,6 +17988,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18018,15 +17997,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18208,6 +18186,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18216,15 +18195,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18500,6 +18478,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18508,15 +18487,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18692,6 +18670,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18700,11 +18679,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18866,6 +18848,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18874,18 +18857,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19050,6 +19029,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19058,15 +19038,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19245,6 +19224,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19253,15 +19233,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19833,6 +19812,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19841,15 +19821,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20045,6 +20024,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20053,15 +20033,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20234,6 +20213,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20242,15 +20222,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20423,6 +20402,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20431,15 +20411,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20615,6 +20594,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20623,15 +20603,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20810,6 +20789,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20818,15 +20798,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20999,6 +20978,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21007,15 +20987,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21192,6 +21171,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21200,15 +21180,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21571,6 +21550,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21579,15 +21559,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21873,6 +21852,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21881,15 +21861,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22055,6 +22034,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22063,15 +22043,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22223,6 +22202,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22231,18 +22211,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22578,6 +22554,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22586,15 +22563,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22789,6 +22765,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22797,15 +22774,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22984,6 +22960,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22992,18 +22969,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23266,6 +23239,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23274,15 +23248,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23368,6 +23341,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23376,15 +23350,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23474,6 +23447,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23482,15 +23456,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23677,6 +23650,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23685,15 +23659,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23897,6 +23870,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23905,11 +23879,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24096,6 +24073,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24104,18 +24082,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24395,6 +24369,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24403,15 +24378,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24579,6 +24553,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24587,15 +24562,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24688,6 +24662,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24696,15 +24671,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24815,6 +24789,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24823,15 +24798,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25014,6 +24988,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25022,18 +24997,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25374,6 +25345,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25382,15 +25354,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25495,6 +25466,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25503,15 +25475,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25603,6 +25574,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25611,15 +25583,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25711,6 +25682,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25719,15 +25691,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25892,6 +25863,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25900,15 +25872,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26072,6 +26043,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26080,15 +26052,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26289,6 +26260,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26297,15 +26269,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26466,6 +26437,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26474,15 +26446,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26801,6 +26772,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26809,15 +26781,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27010,6 +26981,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27018,11 +26990,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27199,6 +27174,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27207,18 +27183,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27506,6 +27478,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27514,15 +27487,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27724,6 +27696,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27732,11 +27705,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27921,6 +27897,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27929,18 +27906,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py index d866dfb6ffe5..e347264480ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -292,6 +294,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -300,18 +303,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -625,6 +624,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -633,15 +633,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -734,6 +733,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -742,15 +742,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -843,6 +842,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -851,15 +851,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -966,6 +965,7 @@ async def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -974,11 +974,14 @@ async def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1216,6 +1219,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1224,15 +1228,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1411,6 +1414,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1419,11 +1423,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1580,6 +1587,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1588,18 +1596,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1954,6 +1958,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1962,15 +1967,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2058,6 +2062,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2066,15 +2071,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2182,6 +2186,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2190,15 +2195,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2367,6 +2371,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2375,15 +2380,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2555,6 +2559,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2563,15 +2568,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2746,6 +2750,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2754,15 +2759,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2954,6 +2958,7 @@ async def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2962,15 +2967,14 @@ async def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4409,11 +4413,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4971,11 +4971,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5451,6 +5447,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5459,15 +5456,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5655,6 +5651,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5663,11 +5660,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5838,6 +5838,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5846,18 +5847,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6375,11 +6372,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6961,6 +6954,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6969,15 +6963,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7171,6 +7164,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7179,11 +7173,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7361,6 +7358,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7369,18 +7367,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8507,6 +8501,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8515,15 +8510,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8705,6 +8699,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8713,15 +8708,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8900,6 +8894,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8908,11 +8903,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9073,6 +9071,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9081,18 +9080,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9308,6 +9303,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9316,15 +9312,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9411,6 +9406,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9419,15 +9415,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9815,6 +9810,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9823,15 +9819,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9923,6 +9918,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9931,16 +9927,15 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10024,6 +10019,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10032,15 +10028,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10124,6 +10119,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10132,15 +10128,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10224,6 +10219,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10232,15 +10228,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10345,6 +10340,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10353,15 +10349,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10582,6 +10577,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10590,15 +10586,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10738,6 +10733,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10746,16 +10742,15 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10867,6 +10862,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10875,16 +10871,15 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11066,6 +11061,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11074,15 +11070,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11362,6 +11357,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11370,15 +11366,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11554,6 +11549,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11562,11 +11558,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11728,6 +11727,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11736,18 +11736,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11924,6 +11920,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11932,15 +11929,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12119,6 +12115,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12127,15 +12124,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12707,6 +12703,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12715,15 +12712,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12919,6 +12915,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12927,15 +12924,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13108,6 +13104,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13116,15 +13113,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13297,6 +13293,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13305,15 +13302,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13489,6 +13485,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13497,15 +13494,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13684,6 +13680,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13692,15 +13689,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13873,6 +13869,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13881,15 +13878,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14066,6 +14062,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14074,15 +14071,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14445,6 +14441,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14453,15 +14450,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14748,6 +14744,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14756,15 +14753,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14930,6 +14926,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14938,15 +14935,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15098,6 +15094,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15106,18 +15103,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15537,11 +15530,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15706,6 +15695,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15714,19 +15704,15 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16081,6 +16067,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16089,12 +16076,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16265,6 +16255,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16273,19 +16264,15 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16475,6 +16462,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16483,15 +16471,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16686,6 +16673,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16694,15 +16682,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16881,6 +16868,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16889,18 +16877,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17165,6 +17149,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17173,15 +17158,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17269,6 +17253,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17277,15 +17262,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17375,6 +17359,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17383,15 +17368,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17578,6 +17562,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17586,16 +17571,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17799,6 +17783,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17807,12 +17792,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17999,6 +17987,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18007,19 +17996,15 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18301,6 +18286,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18309,15 +18295,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18485,6 +18470,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18493,15 +18479,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18594,6 +18579,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18602,15 +18588,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18721,6 +18706,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18729,15 +18715,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18920,6 +18905,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18928,18 +18914,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19281,6 +19263,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19289,15 +19272,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19402,6 +19384,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19410,15 +19393,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19510,6 +19492,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19518,15 +19501,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19618,6 +19600,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19626,15 +19609,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19800,6 +19782,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19808,15 +19791,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19980,6 +19962,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19988,15 +19971,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20200,6 +20182,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20208,15 +20191,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20378,6 +20360,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20386,15 +20369,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20714,6 +20696,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20722,16 +20705,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20924,6 +20906,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20932,12 +20915,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21114,6 +21100,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21122,19 +21109,15 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21424,6 +21407,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21432,16 +21416,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21643,6 +21626,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21651,12 +21635,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21841,6 +21828,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21849,19 +21837,15 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py index aeaf51279e33..11c110a69dea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6223,6 +6225,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6231,18 +6234,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6555,6 +6554,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6563,15 +6563,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6664,6 +6663,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6672,15 +6672,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6773,6 +6772,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6781,15 +6781,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6896,6 +6895,7 @@ def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6904,11 +6904,14 @@ def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7145,6 +7148,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7153,15 +7157,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7340,6 +7343,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7348,11 +7352,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7507,6 +7514,7 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7515,18 +7523,14 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7875,6 +7879,7 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7883,15 +7888,14 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7975,6 +7979,7 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7983,15 +7988,14 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8097,6 +8101,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8105,15 +8110,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8282,6 +8286,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8290,15 +8295,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8470,6 +8474,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8478,15 +8483,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8661,6 +8665,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8669,15 +8674,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8869,6 +8873,7 @@ def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8877,15 +8882,14 @@ def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10318,11 +10322,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10880,11 +10880,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11356,6 +11352,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11364,15 +11361,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11557,6 +11553,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11565,11 +11562,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11737,6 +11737,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11745,18 +11746,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12273,11 +12270,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12857,6 +12850,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12865,15 +12859,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13067,6 +13060,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13075,11 +13069,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13257,6 +13254,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13265,18 +13263,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14402,6 +14396,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14410,15 +14405,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14600,6 +14594,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14608,15 +14603,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14792,6 +14786,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14800,11 +14795,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14962,6 +14960,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14970,18 +14969,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15197,6 +15192,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15205,15 +15201,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15298,6 +15293,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15306,15 +15302,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15699,6 +15694,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15707,15 +15703,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15807,6 +15802,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15815,16 +15811,15 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15908,6 +15903,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15916,15 +15912,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16008,6 +16003,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16016,15 +16012,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16108,6 +16103,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16116,15 +16112,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16229,6 +16224,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16237,15 +16233,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16464,6 +16459,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16472,15 +16468,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16616,6 +16611,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16624,16 +16620,15 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16745,6 +16740,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16753,16 +16749,15 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16944,6 +16939,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16952,15 +16948,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17237,6 +17232,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17245,15 +17241,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17429,6 +17424,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17437,11 +17433,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17603,6 +17602,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17611,18 +17611,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17799,6 +17795,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17807,15 +17804,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17994,6 +17990,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18002,15 +17999,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18582,6 +18578,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18590,15 +18587,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18794,6 +18790,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18802,15 +18799,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18983,6 +18979,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18991,15 +18988,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19172,6 +19168,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19180,15 +19177,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19364,6 +19360,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19372,15 +19369,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19559,6 +19555,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19567,15 +19564,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19748,6 +19744,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19756,15 +19753,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19941,6 +19937,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19949,15 +19946,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20320,6 +20316,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20328,15 +20325,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20622,6 +20618,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20630,15 +20627,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20804,6 +20800,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20812,15 +20809,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20972,6 +20968,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20980,18 +20977,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21411,11 +21404,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21580,6 +21569,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21588,19 +21578,15 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21955,6 +21941,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21963,12 +21950,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22139,6 +22129,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22147,19 +22138,15 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22349,6 +22336,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22357,15 +22345,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22560,6 +22547,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22568,15 +22556,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22755,6 +22742,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22763,18 +22751,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23037,6 +23021,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23045,15 +23030,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23139,6 +23123,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23147,15 +23132,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23245,6 +23229,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23253,15 +23238,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23448,6 +23432,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23456,16 +23441,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23669,6 +23653,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23677,12 +23662,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23869,6 +23857,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23877,19 +23866,15 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24171,6 +24156,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24179,15 +24165,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24355,6 +24340,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24363,15 +24349,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24464,6 +24449,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24472,15 +24458,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24591,6 +24576,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24599,15 +24585,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24790,6 +24775,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24798,18 +24784,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25151,6 +25133,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25159,15 +25142,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25272,6 +25254,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25280,15 +25263,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25380,6 +25362,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25388,15 +25371,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25488,6 +25470,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25496,15 +25479,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25670,6 +25652,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25678,15 +25661,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25850,6 +25832,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25858,15 +25841,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26067,6 +26049,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26075,15 +26058,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26244,6 +26226,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26252,15 +26235,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26579,6 +26561,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26587,16 +26570,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26789,6 +26771,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26797,12 +26780,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26979,6 +26965,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26987,19 +26974,15 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27289,6 +27272,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27297,16 +27281,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27508,6 +27491,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27516,12 +27500,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27706,6 +27693,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27714,19 +27702,15 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated2, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py index 3dc8e6473ed8..56554e8fc636 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1125,11 +1127,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1687,11 +1685,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2167,6 +2161,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2175,15 +2170,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2371,6 +2365,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2379,11 +2374,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2554,6 +2552,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2562,18 +2561,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3091,11 +3086,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3677,6 +3668,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3685,15 +3677,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3887,6 +3878,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3895,11 +3887,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4077,6 +4072,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4085,18 +4081,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5218,6 +5210,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5226,15 +5219,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5416,6 +5408,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5424,15 +5417,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5611,6 +5603,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5619,11 +5612,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5784,6 +5780,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5792,18 +5789,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6019,6 +6012,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6027,15 +6021,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6122,6 +6115,7 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6130,15 +6124,14 @@ async def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6526,6 +6519,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6534,15 +6528,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6634,6 +6627,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6642,15 +6636,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6734,6 +6727,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6742,15 +6736,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6834,6 +6827,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6842,15 +6836,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6934,6 +6927,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6942,15 +6936,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7055,6 +7048,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7063,15 +7057,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7291,6 +7284,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7299,15 +7293,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7447,6 +7440,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7455,15 +7449,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7575,6 +7568,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7583,15 +7577,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7773,6 +7766,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7781,15 +7775,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8068,6 +8061,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8076,15 +8070,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8260,6 +8253,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8268,11 +8262,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8434,6 +8431,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8442,18 +8440,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8630,6 +8624,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8638,15 +8633,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8825,6 +8819,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8833,15 +8828,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9413,6 +9407,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9421,15 +9416,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9625,6 +9619,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9633,15 +9628,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9814,6 +9808,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9822,15 +9817,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10003,6 +9997,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10011,15 +10006,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10195,6 +10189,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10203,15 +10198,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10390,6 +10384,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10398,15 +10393,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10579,6 +10573,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10587,15 +10582,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10772,6 +10766,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10780,15 +10775,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11151,6 +11145,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11159,15 +11154,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11454,6 +11448,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11462,15 +11457,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11636,6 +11630,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11644,15 +11639,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11804,6 +11798,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11812,18 +11807,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12242,11 +12233,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12410,6 +12397,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12418,18 +12406,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12781,6 +12765,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12789,11 +12774,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12964,6 +12952,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12972,18 +12961,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13253,11 +13238,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13766,6 +13747,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13774,15 +13756,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13976,6 +13957,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13984,15 +13966,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14167,6 +14148,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14175,18 +14157,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14477,6 +14455,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14485,15 +14464,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14688,6 +14666,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14696,15 +14675,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14883,6 +14861,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14891,18 +14870,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15167,6 +15142,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15175,15 +15151,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15271,6 +15246,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15279,15 +15255,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15377,6 +15352,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15385,15 +15361,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15580,6 +15555,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15588,15 +15564,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15800,6 +15775,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15808,11 +15784,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15999,6 +15978,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16007,18 +15987,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16298,6 +16274,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16306,15 +16283,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16482,6 +16458,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16490,15 +16467,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16591,6 +16567,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16599,15 +16576,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16718,6 +16694,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16726,15 +16703,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16917,6 +16893,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16925,18 +16902,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17278,6 +17251,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17286,15 +17260,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17399,6 +17372,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17407,15 +17381,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17507,6 +17480,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17515,15 +17489,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17615,6 +17588,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17623,15 +17597,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17796,6 +17769,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17804,15 +17778,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17976,6 +17949,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17984,15 +17958,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18196,6 +18169,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18204,15 +18178,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18374,6 +18347,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18382,15 +18356,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18710,6 +18683,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18718,15 +18692,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18919,6 +18892,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18927,11 +18901,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19108,6 +19085,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19116,18 +19094,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19415,6 +19389,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19423,15 +19398,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19633,6 +19607,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19641,11 +19616,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19830,6 +19808,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19838,18 +19817,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20144,6 +20119,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20152,15 +20128,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20328,6 +20303,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20336,15 +20312,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20554,6 +20529,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20562,18 +20538,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20828,6 +20800,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20836,15 +20809,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21011,6 +20983,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21019,15 +20992,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21152,6 +21124,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21160,15 +21133,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21343,6 +21315,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21351,15 +21324,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21580,6 +21552,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21588,18 +21561,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21856,6 +21825,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21864,15 +21834,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22039,6 +22008,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22047,15 +22017,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22184,6 +22153,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22192,15 +22162,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22385,6 +22354,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22393,15 +22363,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22629,6 +22598,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22637,18 +22607,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23014,6 +22980,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23022,15 +22989,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23211,6 +23177,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23219,15 +23186,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23448,6 +23414,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23456,18 +23423,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23786,6 +23749,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23794,15 +23758,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24048,6 +24011,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24056,18 +24020,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24444,6 +24404,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24452,15 +24413,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24654,6 +24614,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24662,15 +24623,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py index 599a49d7561d..b46c9bddb7fa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -7692,11 +7694,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8254,11 +8252,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8730,6 +8724,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8738,15 +8733,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8931,6 +8925,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8939,11 +8934,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9111,6 +9109,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9119,18 +9118,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9647,11 +9642,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10231,6 +10222,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10239,15 +10231,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10441,6 +10432,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10449,11 +10441,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10631,6 +10626,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10639,18 +10635,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11771,6 +11763,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11779,15 +11772,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11969,6 +11961,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11977,15 +11970,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12161,6 +12153,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12169,11 +12162,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12331,6 +12327,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12339,18 +12336,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12566,6 +12559,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12574,15 +12568,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12667,6 +12660,7 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12675,15 +12669,14 @@ def _deallocate_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13068,6 +13061,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13076,15 +13070,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13176,6 +13169,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13184,15 +13178,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13276,6 +13269,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13284,15 +13278,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13376,6 +13369,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13384,15 +13378,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13476,6 +13469,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13484,15 +13478,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13597,6 +13590,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13605,15 +13599,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13831,6 +13824,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13839,15 +13833,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13983,6 +13976,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13991,15 +13985,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14111,6 +14104,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14119,15 +14113,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14309,6 +14302,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14317,15 +14311,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14601,6 +14594,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14609,15 +14603,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14793,6 +14786,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14801,11 +14795,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14967,6 +14964,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14975,18 +14973,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15163,6 +15157,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15171,15 +15166,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15358,6 +15352,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15366,15 +15361,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15946,6 +15940,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15954,15 +15949,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16158,6 +16152,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16166,15 +16161,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16347,6 +16341,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16355,15 +16350,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16536,6 +16530,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16544,15 +16539,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16728,6 +16722,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16736,15 +16731,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16923,6 +16917,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16931,15 +16926,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17112,6 +17106,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17120,15 +17115,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17305,6 +17299,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17313,15 +17308,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17684,6 +17678,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17692,15 +17687,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17986,6 +17980,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17994,15 +17989,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18168,6 +18162,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18176,15 +18171,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18336,6 +18330,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18344,18 +18339,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18774,11 +18765,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18942,6 +18929,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18950,18 +18938,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19313,6 +19297,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19321,11 +19306,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19496,6 +19484,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19504,18 +19493,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19785,11 +19770,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20298,6 +20279,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20306,15 +20288,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20508,6 +20489,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20516,15 +20498,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20699,6 +20680,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20707,18 +20689,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21009,6 +20987,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21017,15 +20996,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21220,6 +21198,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21228,15 +21207,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21415,6 +21393,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21423,18 +21402,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21697,6 +21672,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21705,15 +21681,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21799,6 +21774,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21807,15 +21783,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21905,6 +21880,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21913,15 +21889,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22108,6 +22083,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22116,15 +22092,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22328,6 +22303,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22336,11 +22312,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22527,6 +22506,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22535,18 +22515,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22826,6 +22802,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22834,15 +22811,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23010,6 +22986,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23018,15 +22995,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23119,6 +23095,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23127,15 +23104,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23246,6 +23222,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23254,15 +23231,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23445,6 +23421,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23453,18 +23430,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23806,6 +23779,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23814,15 +23788,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23927,6 +23900,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23935,15 +23909,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24035,6 +24008,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24043,15 +24017,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24143,6 +24116,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24151,15 +24125,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24324,6 +24297,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24332,15 +24306,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24504,6 +24477,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24512,15 +24486,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24721,6 +24694,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24729,15 +24703,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24898,6 +24871,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24906,15 +24880,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25233,6 +25206,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25241,15 +25215,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25442,6 +25415,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25450,11 +25424,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25631,6 +25608,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25639,18 +25617,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25938,6 +25912,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25946,15 +25921,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26156,6 +26130,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26164,11 +26139,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26353,6 +26331,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26361,18 +26340,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26667,6 +26642,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26675,15 +26651,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26851,6 +26826,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26859,15 +26835,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27077,6 +27052,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27085,18 +27061,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27351,6 +27323,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27359,15 +27332,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27529,6 +27501,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27537,15 +27510,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27668,6 +27640,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27676,15 +27649,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27856,6 +27828,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27864,15 +27837,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28088,6 +28060,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28096,18 +28069,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28362,6 +28331,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28370,15 +28340,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28540,6 +28509,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28548,15 +28518,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28683,6 +28652,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28691,15 +28661,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28881,6 +28850,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28889,15 +28859,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29120,6 +29089,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29128,18 +29098,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29499,6 +29465,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29507,15 +29474,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29693,6 +29659,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29701,15 +29668,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29925,6 +29891,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29933,18 +29900,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30259,6 +30222,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30267,15 +30231,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30521,6 +30484,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30529,18 +30493,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30916,6 +30876,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30924,15 +30885,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31123,6 +31083,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -31131,15 +31092,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py index 1905404fe8b5..aef77ede943d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1124,11 +1126,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1686,11 +1684,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2166,6 +2160,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2174,15 +2169,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2370,6 +2364,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2378,11 +2373,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2553,6 +2551,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2561,18 +2560,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3090,11 +3085,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3676,6 +3667,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3684,15 +3676,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3886,6 +3877,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3894,11 +3886,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4076,6 +4071,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4084,18 +4080,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5217,6 +5209,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5225,15 +5218,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5415,6 +5407,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5423,15 +5416,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5610,6 +5602,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5618,11 +5611,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5779,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,18 +5788,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6018,6 +6011,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6026,15 +6020,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6124,6 +6117,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6132,15 +6126,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6534,6 +6527,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6542,15 +6536,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6642,6 +6635,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6650,15 +6644,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6742,6 +6735,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6750,15 +6744,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6842,6 +6835,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6850,15 +6844,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6942,6 +6935,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6950,15 +6944,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7063,6 +7056,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7071,15 +7065,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7299,6 +7292,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7307,15 +7301,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7455,6 +7448,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7463,15 +7457,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7583,6 +7576,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7591,15 +7585,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7781,6 +7774,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7789,15 +7783,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8076,6 +8069,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8084,15 +8078,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8268,6 +8261,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8276,11 +8270,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8442,6 +8439,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8450,18 +8448,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8638,6 +8632,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8646,15 +8641,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8833,6 +8827,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8841,15 +8836,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9421,6 +9415,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9429,15 +9424,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9633,6 +9627,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9641,15 +9636,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9822,6 +9816,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9830,15 +9825,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10011,6 +10005,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10019,15 +10014,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10203,6 +10197,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10211,15 +10206,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10398,6 +10392,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10406,15 +10401,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10587,6 +10581,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10595,15 +10590,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10780,6 +10774,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10788,15 +10783,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11159,6 +11153,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11167,15 +11162,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11462,6 +11456,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11470,15 +11465,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11644,6 +11638,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11652,15 +11647,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11812,6 +11806,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11820,18 +11815,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12250,11 +12241,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12418,6 +12405,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12426,18 +12414,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12789,6 +12773,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12797,11 +12782,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12972,6 +12960,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12980,18 +12969,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13261,11 +13246,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13774,6 +13755,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13782,15 +13764,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13984,6 +13965,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13992,15 +13974,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14175,6 +14156,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14183,18 +14165,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14485,6 +14463,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14493,15 +14472,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14696,6 +14674,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14704,15 +14683,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14891,6 +14869,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14899,18 +14878,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15175,6 +15150,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15183,15 +15159,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15279,6 +15254,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15287,15 +15263,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15385,6 +15360,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15393,15 +15369,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15588,6 +15563,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15596,15 +15572,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15808,6 +15783,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15816,11 +15792,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16007,6 +15986,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16015,18 +15995,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16306,6 +16282,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16314,15 +16291,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16490,6 +16466,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16498,15 +16475,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16599,6 +16575,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16607,15 +16584,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16726,6 +16702,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16734,15 +16711,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16925,6 +16901,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16933,18 +16910,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17286,6 +17259,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17294,15 +17268,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17407,6 +17380,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17415,15 +17389,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17515,6 +17488,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17523,15 +17497,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17623,6 +17596,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17631,15 +17605,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17804,6 +17777,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17812,15 +17786,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17984,6 +17957,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17992,15 +17966,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18204,6 +18177,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18212,15 +18186,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18382,6 +18355,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18390,15 +18364,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18718,6 +18691,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18726,15 +18700,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18927,6 +18900,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18935,11 +18909,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19116,6 +19093,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19124,18 +19102,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19423,6 +19397,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19431,15 +19406,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19641,6 +19615,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19649,11 +19624,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19838,6 +19816,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19846,18 +19825,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20258,6 +20233,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20266,18 +20242,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20454,6 +20426,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20462,11 +20435,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20692,6 +20668,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20700,18 +20677,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20987,6 +20960,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20995,18 +20969,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21202,6 +21172,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21210,11 +21181,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21451,6 +21425,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21459,18 +21434,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21687,6 +21658,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21695,18 +21667,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21924,6 +21892,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21932,11 +21901,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22217,6 +22189,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22225,18 +22198,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22465,6 +22434,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22473,18 +22443,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22684,6 +22650,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22692,11 +22659,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22940,6 +22910,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22948,18 +22919,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23177,6 +23144,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23185,18 +23153,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23416,6 +23380,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23424,11 +23389,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23711,6 +23679,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23719,18 +23688,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23958,6 +23923,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23966,15 +23932,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py index 8d44a2449107..8b222620a171 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -7784,11 +7786,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8346,11 +8344,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8822,6 +8816,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8830,15 +8825,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9023,6 +9017,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9031,11 +9026,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9203,6 +9201,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9211,18 +9210,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9739,11 +9734,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10323,6 +10314,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10331,15 +10323,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10533,6 +10524,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10541,11 +10533,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10723,6 +10718,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10731,18 +10727,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11863,6 +11855,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11871,15 +11864,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12061,6 +12053,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12069,15 +12062,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12253,6 +12245,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12261,11 +12254,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12423,6 +12419,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12431,18 +12428,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12658,6 +12651,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12666,15 +12660,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12762,6 +12755,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12770,15 +12764,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13169,6 +13162,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13177,15 +13171,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13277,6 +13270,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13285,15 +13279,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13377,6 +13370,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13385,15 +13379,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13477,6 +13470,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13485,15 +13479,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13577,6 +13570,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13585,15 +13579,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13698,6 +13691,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13706,15 +13700,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13932,6 +13925,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13940,15 +13934,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14084,6 +14077,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14092,15 +14086,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14212,6 +14205,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14220,15 +14214,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14410,6 +14403,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14418,15 +14412,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14702,6 +14695,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14710,15 +14704,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14894,6 +14887,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14902,11 +14896,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15068,6 +15065,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15076,18 +15074,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15264,6 +15258,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15272,15 +15267,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15459,6 +15453,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15467,15 +15462,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16047,6 +16041,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16055,15 +16050,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16259,6 +16253,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16267,15 +16262,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16448,6 +16442,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16456,15 +16451,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16637,6 +16631,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16645,15 +16640,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16829,6 +16823,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16837,15 +16832,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17024,6 +17018,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17032,15 +17027,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17213,6 +17207,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17221,15 +17216,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17406,6 +17400,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17414,15 +17409,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17785,6 +17779,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17793,15 +17788,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18087,6 +18081,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18095,15 +18090,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18269,6 +18263,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18277,15 +18272,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18437,6 +18431,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18445,18 +18440,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18875,11 +18866,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19043,6 +19030,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19051,18 +19039,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19414,6 +19398,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19422,11 +19407,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19597,6 +19585,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19605,18 +19594,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19886,11 +19871,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20399,6 +20380,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20407,15 +20389,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20609,6 +20590,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20617,15 +20599,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20800,6 +20781,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20808,18 +20790,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21110,6 +21088,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21118,15 +21097,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21321,6 +21299,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21329,15 +21308,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21516,6 +21494,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21524,18 +21503,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21798,6 +21773,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21806,15 +21782,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21900,6 +21875,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21908,15 +21884,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22006,6 +21981,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22014,15 +21990,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22209,6 +22184,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22217,15 +22193,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22429,6 +22404,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22437,11 +22413,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22628,6 +22607,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22636,18 +22616,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22927,6 +22903,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22935,15 +22912,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23111,6 +23087,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23119,15 +23096,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23220,6 +23196,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23228,15 +23205,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23347,6 +23323,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23355,15 +23332,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23546,6 +23522,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23554,18 +23531,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23907,6 +23880,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23915,15 +23889,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24028,6 +24001,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24036,15 +24010,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24136,6 +24109,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24144,15 +24118,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24244,6 +24217,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24252,15 +24226,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24425,6 +24398,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24433,15 +24407,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24605,6 +24578,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24613,15 +24587,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24822,6 +24795,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24830,15 +24804,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24999,6 +24972,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25007,15 +24981,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25334,6 +25307,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25342,15 +25316,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25543,6 +25516,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25551,11 +25525,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25732,6 +25709,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25740,18 +25718,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26039,6 +26013,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26047,15 +26022,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26257,6 +26231,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26265,11 +26240,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26454,6 +26432,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26462,18 +26441,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26873,6 +26848,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26881,18 +26857,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27066,6 +27038,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27074,11 +27047,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27301,6 +27277,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27309,18 +27286,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27596,6 +27569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27604,18 +27578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27811,6 +27781,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27819,11 +27790,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28060,6 +28034,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28068,18 +28043,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28295,6 +28266,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28303,18 +28275,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28532,6 +28500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28540,11 +28509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -28825,6 +28797,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -28833,18 +28806,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29073,6 +29042,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29081,18 +29051,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29292,6 +29258,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29300,11 +29267,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29548,6 +29518,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29556,18 +29527,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -29784,6 +29751,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -29792,18 +29760,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30023,6 +29987,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30031,11 +29996,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30318,6 +30286,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30326,18 +30295,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -30565,6 +30530,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -30573,15 +30539,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_operations.py index 43c14a67ec37..f46e4c0076ad 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1146,6 +1145,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1154,15 +1154,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1337,6 +1336,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1345,15 +1345,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1574,6 +1573,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1582,18 +1582,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1850,6 +1846,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1858,15 +1855,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2033,6 +2029,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2041,15 +2038,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2178,6 +2174,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2186,15 +2183,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2379,6 +2375,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2387,15 +2384,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2623,6 +2619,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2631,18 +2628,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3008,6 +3001,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3016,15 +3010,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3205,6 +3198,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3213,15 +3207,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,6 +3435,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3450,18 +3444,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3780,6 +3770,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3788,15 +3779,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4042,6 +4032,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4050,18 +4041,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4438,6 +4425,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4446,15 +4434,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4648,6 +4635,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4656,15 +4644,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_operations.py index 49031d6ce27b..60559972a189 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2315,6 +2314,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2323,15 +2323,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2503,6 +2502,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2511,15 +2511,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2735,6 +2734,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2743,18 +2743,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3009,6 +3005,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3017,15 +3014,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3187,6 +3183,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3195,15 +3192,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3330,6 +3326,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3338,15 +3335,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3528,6 +3524,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3536,15 +3533,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3767,6 +3763,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3775,18 +3772,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4146,6 +4139,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4154,15 +4148,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4340,6 +4333,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4348,15 +4342,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4572,6 +4565,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4580,18 +4574,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4906,6 +4896,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4914,15 +4905,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5168,6 +5158,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5176,18 +5167,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5563,6 +5550,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5571,15 +5559,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5770,6 +5757,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5778,15 +5766,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py index 1a84b47f690d..bef1d2cf2713 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -127,6 +129,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -135,18 +138,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -323,6 +322,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -331,11 +331,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -566,6 +569,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -574,18 +578,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -861,6 +861,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -869,18 +870,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1076,6 +1073,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1084,11 +1082,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1325,6 +1326,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1333,18 +1335,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1561,6 +1559,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1569,18 +1568,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1798,6 +1793,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1806,11 +1802,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2091,6 +2090,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2099,18 +2099,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2339,6 +2335,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2347,18 +2344,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2558,6 +2551,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2566,11 +2560,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2814,6 +2811,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2822,18 +2820,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3051,6 +3045,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3059,18 +3054,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3290,6 +3281,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3298,11 +3290,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3585,6 +3580,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3593,18 +3589,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3832,6 +3824,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3840,15 +3833,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py index 7b4a6f565906..abf86101c325 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1055,6 +1057,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1063,18 +1066,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1248,6 +1247,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1256,11 +1256,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1488,6 +1491,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1496,18 +1500,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1783,6 +1783,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1791,18 +1792,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1995,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,11 +2004,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2247,6 +2248,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2255,18 +2257,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2482,6 +2480,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2490,18 +2489,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2719,6 +2714,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2727,11 +2723,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3012,6 +3011,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3020,18 +3020,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3260,6 +3256,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3268,18 +3265,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3479,6 +3472,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3487,11 +3481,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3735,6 +3732,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3743,18 +3741,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3971,6 +3965,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3979,18 +3974,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4210,6 +4201,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4218,11 +4210,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4505,6 +4500,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4513,18 +4509,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4752,6 +4744,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4760,15 +4753,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py index 55f7368a4823..0b010741abeb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -1088,11 +1090,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1650,11 +1648,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2130,6 +2124,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2138,15 +2133,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2334,6 +2328,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2342,11 +2337,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2517,6 +2515,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2525,18 +2524,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2782,6 +2777,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2790,11 +2786,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3161,11 +3160,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3747,6 +3742,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3755,15 +3751,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3957,6 +3952,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3965,11 +3961,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4147,6 +4146,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4155,18 +4155,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5288,6 +5284,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5296,15 +5293,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5486,6 +5482,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5494,15 +5491,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5681,6 +5677,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5689,11 +5686,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5854,6 +5854,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5862,18 +5863,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6089,6 +6086,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6097,15 +6095,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6195,6 +6192,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6203,15 +6201,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6621,6 +6618,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6629,15 +6627,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6729,6 +6726,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6737,15 +6735,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6829,6 +6826,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6837,15 +6835,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6929,6 +6926,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6937,15 +6935,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7029,6 +7026,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7037,15 +7035,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7150,6 +7147,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7158,15 +7156,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7386,6 +7383,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7394,15 +7392,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7542,6 +7539,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7550,15 +7548,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7670,6 +7667,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7678,15 +7676,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7868,6 +7865,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7876,15 +7874,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8163,6 +8160,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8171,15 +8169,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8355,6 +8352,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8363,11 +8361,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8529,6 +8530,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8537,18 +8539,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8725,6 +8723,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8733,15 +8732,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8920,6 +8918,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8928,15 +8927,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9508,6 +9506,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9516,15 +9515,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9720,6 +9718,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9728,15 +9727,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9909,6 +9907,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9917,15 +9916,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10098,6 +10096,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10106,15 +10105,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10290,6 +10288,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10298,15 +10297,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10485,6 +10483,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10493,15 +10492,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10674,6 +10672,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10682,15 +10681,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10867,6 +10865,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10875,15 +10874,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11261,6 +11259,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11269,15 +11268,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11564,6 +11562,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11572,15 +11571,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11746,6 +11744,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11754,15 +11753,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11914,6 +11912,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11922,18 +11921,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12352,11 +12347,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12520,6 +12511,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12528,18 +12520,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12891,6 +12879,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12899,11 +12888,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13074,6 +13066,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13082,18 +13075,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13373,11 +13362,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13886,6 +13871,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13894,15 +13880,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14096,6 +14081,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14104,15 +14090,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14287,6 +14272,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14295,18 +14281,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14597,6 +14579,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14605,15 +14588,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14808,6 +14790,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14816,15 +14799,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15003,6 +14985,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15011,18 +14994,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15287,6 +15266,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15295,15 +15275,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15391,6 +15370,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15399,15 +15379,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15497,6 +15476,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15505,15 +15485,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15700,6 +15679,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15708,15 +15688,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15920,6 +15899,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15928,11 +15908,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16119,6 +16102,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16127,18 +16111,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16418,6 +16398,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16426,15 +16407,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16602,6 +16582,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16610,15 +16591,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16711,6 +16691,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16719,15 +16700,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16838,6 +16818,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16846,15 +16827,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17037,6 +17017,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17045,18 +17026,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17398,6 +17375,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17406,15 +17384,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17519,6 +17496,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17527,15 +17505,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17627,6 +17604,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17635,15 +17613,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17735,6 +17712,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17743,15 +17721,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17916,6 +17893,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17924,15 +17902,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18096,6 +18073,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18104,15 +18082,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18316,6 +18293,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18324,15 +18302,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18494,6 +18471,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18502,15 +18480,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18830,6 +18807,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18838,15 +18816,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19039,6 +19016,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19047,11 +19025,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19228,6 +19209,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19236,18 +19218,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19535,6 +19513,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19543,15 +19522,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19753,6 +19731,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19761,11 +19740,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19950,6 +19932,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19958,18 +19941,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py index 34fe7b6f2fbf..7f30e13b443d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6757,11 +6759,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7319,11 +7317,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7795,6 +7789,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7803,15 +7798,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7996,6 +7990,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8004,11 +7999,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8176,6 +8174,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8184,18 +8183,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8440,6 +8435,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8448,11 +8444,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8819,11 +8818,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9403,6 +9398,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9411,15 +9407,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9613,6 +9608,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9621,11 +9617,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9803,6 +9802,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9811,18 +9811,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10943,6 +10939,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10951,15 +10948,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11141,6 +11137,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11149,15 +11146,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11333,6 +11329,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11341,11 +11338,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11503,6 +11503,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11511,18 +11512,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11738,6 +11735,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11746,15 +11744,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11842,6 +11839,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11850,15 +11848,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12265,6 +12262,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12273,15 +12271,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12373,6 +12370,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12381,15 +12379,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12473,6 +12470,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12481,15 +12479,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12573,6 +12570,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12581,15 +12579,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12673,6 +12670,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12681,15 +12679,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12794,6 +12791,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12802,15 +12800,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13028,6 +13025,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13036,15 +13034,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13180,6 +13177,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13188,15 +13186,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13308,6 +13305,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13316,15 +13314,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13506,6 +13503,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13514,15 +13512,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13798,6 +13795,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13806,15 +13804,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13990,6 +13987,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13998,11 +13996,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14164,6 +14165,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14172,18 +14174,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14360,6 +14358,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14368,15 +14367,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14555,6 +14553,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14563,15 +14562,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15143,6 +15141,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15151,15 +15150,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15355,6 +15353,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15363,15 +15362,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15544,6 +15542,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15552,15 +15551,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15733,6 +15731,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15741,15 +15740,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15925,6 +15923,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15933,15 +15932,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16120,6 +16118,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16128,15 +16127,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16309,6 +16307,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16317,15 +16316,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16502,6 +16500,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16510,15 +16509,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16896,6 +16894,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16904,15 +16903,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17198,6 +17196,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17206,15 +17205,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17380,6 +17378,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17388,15 +17387,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17548,6 +17546,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17556,18 +17555,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17986,11 +17981,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18154,6 +18145,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18162,18 +18154,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18525,6 +18513,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18533,11 +18522,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18708,6 +18700,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18716,18 +18709,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19007,11 +18996,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19520,6 +19505,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19528,15 +19514,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19730,6 +19715,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19738,15 +19724,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19921,6 +19906,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19929,18 +19915,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20231,6 +20213,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20239,15 +20222,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20442,6 +20424,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20450,15 +20433,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20637,6 +20619,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20645,18 +20628,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20919,6 +20898,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20927,15 +20907,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21021,6 +21000,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21029,15 +21009,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21127,6 +21106,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21135,15 +21115,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21330,6 +21309,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21338,15 +21318,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21550,6 +21529,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21558,11 +21538,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21749,6 +21732,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21757,18 +21741,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22048,6 +22028,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22056,15 +22037,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22232,6 +22212,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22240,15 +22221,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22341,6 +22321,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22349,15 +22330,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22468,6 +22448,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22476,15 +22457,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22667,6 +22647,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22675,18 +22656,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23028,6 +23005,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23036,15 +23014,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23149,6 +23126,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23157,15 +23135,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23257,6 +23234,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23265,15 +23243,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23365,6 +23342,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23373,15 +23351,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23546,6 +23523,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23554,15 +23532,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23726,6 +23703,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23734,15 +23712,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23943,6 +23920,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23951,15 +23929,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24120,6 +24097,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24128,15 +24106,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24455,6 +24432,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24463,15 +24441,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24664,6 +24641,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24672,11 +24650,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24853,6 +24834,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24861,18 +24843,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25160,6 +25138,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25168,15 +25147,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25378,6 +25356,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25386,11 +25365,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25575,6 +25557,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25583,18 +25566,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_operations.py index c3d667fe53d9..12cb109196af 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1146,6 +1145,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1154,15 +1154,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1337,6 +1336,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1345,15 +1345,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1574,6 +1573,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1582,18 +1582,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1850,6 +1846,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1858,15 +1855,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2033,6 +2029,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2041,15 +2038,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2178,6 +2174,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2186,15 +2183,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2379,6 +2375,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2387,15 +2384,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2623,6 +2619,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2631,18 +2628,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3008,6 +3001,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3016,15 +3010,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3205,6 +3198,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3213,15 +3207,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3442,6 +3435,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3450,18 +3444,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3780,6 +3770,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3788,15 +3779,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4042,6 +4032,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4050,18 +4041,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4438,6 +4425,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4446,15 +4434,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4648,6 +4635,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4656,15 +4644,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_operations.py index 91c3587a8ba6..76182efa78a0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2315,6 +2314,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2323,15 +2323,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2503,6 +2502,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2511,15 +2511,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2735,6 +2734,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2743,18 +2743,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3009,6 +3005,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3017,15 +3014,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3187,6 +3183,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3195,15 +3192,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3330,6 +3326,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3338,15 +3335,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3528,6 +3524,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3536,15 +3533,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3767,6 +3763,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3775,18 +3772,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4146,6 +4139,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4154,15 +4148,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4340,6 +4333,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4348,15 +4342,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4572,6 +4565,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4580,18 +4574,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4906,6 +4896,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4914,15 +4905,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5168,6 +5158,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5176,18 +5167,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5563,6 +5550,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5571,15 +5559,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5770,6 +5757,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5778,15 +5766,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py index 589eff4fc72f..81f02c83a633 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,18 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -334,6 +333,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -342,11 +342,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -577,6 +580,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -585,18 +589,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -872,6 +872,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -880,18 +881,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,6 +1084,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1095,11 +1093,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1336,6 +1337,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1344,18 +1346,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,6 +1570,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1580,18 +1579,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1809,6 +1804,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1817,11 +1813,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,6 +2101,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2110,18 +2110,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2350,6 +2346,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2358,18 +2355,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2569,6 +2562,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2577,11 +2571,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2825,6 +2822,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2833,18 +2831,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3062,6 +3056,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3070,18 +3065,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3301,6 +3292,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3309,11 +3301,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3596,6 +3591,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3604,18 +3600,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3843,6 +3835,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3851,15 +3844,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py index 1328b8f07785..8e4c708d3f5d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1434,6 +1436,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1442,18 +1445,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1627,6 +1626,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1635,11 +1635,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1867,6 +1870,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1875,18 +1879,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,6 +2162,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2170,18 +2171,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,6 +2374,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2385,11 +2383,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2626,6 +2627,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2634,18 +2636,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2861,6 +2859,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2869,18 +2868,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3098,6 +3093,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3106,11 +3102,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3391,6 +3390,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3399,18 +3399,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3639,6 +3635,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3647,18 +3644,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3858,6 +3851,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3866,11 +3860,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4114,6 +4111,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4122,18 +4120,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4350,6 +4344,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4358,18 +4353,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4589,6 +4580,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4597,11 +4589,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4884,6 +4879,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4892,18 +4888,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5131,6 +5123,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5139,15 +5132,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py index d082d10a3ed7..39c96bf5eb23 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -665,6 +667,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -673,15 +676,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -857,6 +859,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -865,11 +868,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1031,6 +1037,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1039,18 +1046,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1227,6 +1230,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1235,15 +1239,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1422,6 +1425,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1430,15 +1434,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2010,6 +2013,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2018,15 +2022,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2222,6 +2225,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2230,15 +2234,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2411,6 +2414,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2419,15 +2423,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2600,6 +2603,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2608,15 +2612,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2792,6 +2795,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2800,15 +2804,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2987,6 +2990,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2995,15 +2999,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3176,6 +3179,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3184,15 +3188,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3369,6 +3372,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3377,15 +3381,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3763,6 +3766,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3771,15 +3775,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3972,6 +3975,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3980,15 +3984,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4183,6 +4186,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4191,15 +4195,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4378,6 +4381,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4386,18 +4390,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4662,6 +4662,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4670,15 +4671,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4766,6 +4766,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4774,15 +4775,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4872,6 +4872,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4880,15 +4881,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5075,6 +5075,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5083,15 +5084,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5295,6 +5295,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5303,11 +5304,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5494,6 +5498,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5502,18 +5507,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5793,6 +5794,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5801,15 +5803,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5977,6 +5978,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5985,15 +5987,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6086,6 +6087,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6094,15 +6096,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6213,6 +6214,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6221,15 +6223,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6412,6 +6413,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6420,18 +6422,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6773,6 +6771,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6781,15 +6780,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6894,6 +6892,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6902,15 +6901,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7002,6 +7000,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7010,15 +7009,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7110,6 +7108,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7118,15 +7117,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7291,6 +7289,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7299,15 +7298,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7471,6 +7469,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7479,15 +7478,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7698,6 +7696,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7706,15 +7705,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7908,6 +7906,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7916,11 +7915,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8098,6 +8100,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8106,18 +8109,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8452,6 +8451,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8460,15 +8460,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8650,6 +8649,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8658,15 +8658,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8845,6 +8844,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8853,11 +8853,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9018,6 +9021,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9026,18 +9030,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9253,6 +9253,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9261,15 +9262,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9359,6 +9359,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9367,15 +9368,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9785,6 +9785,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9793,15 +9794,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9893,6 +9893,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9901,15 +9902,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9993,6 +9993,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10001,15 +10002,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10093,6 +10093,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10101,15 +10102,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10193,6 +10193,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10201,15 +10202,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10314,6 +10314,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10322,15 +10323,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10550,6 +10550,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10558,15 +10559,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10706,6 +10706,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10714,15 +10715,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10834,6 +10834,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10842,15 +10843,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11032,6 +11032,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11040,15 +11041,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12909,11 +12909,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13471,11 +13467,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13951,6 +13943,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13959,15 +13952,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14155,6 +14147,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14163,11 +14156,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14338,6 +14334,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14346,18 +14343,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14603,6 +14596,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14611,11 +14605,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14982,11 +14979,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15347,6 +15340,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15355,15 +15349,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15529,6 +15522,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15537,15 +15531,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15697,6 +15690,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15705,18 +15699,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16135,11 +16125,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16303,6 +16289,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16311,18 +16298,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16674,6 +16657,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16682,11 +16666,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16857,6 +16844,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16865,18 +16853,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17156,11 +17140,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17669,6 +17649,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17677,15 +17658,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17879,6 +17859,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17887,15 +17868,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18070,6 +18050,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18078,18 +18059,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18373,6 +18350,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18381,15 +18359,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18551,6 +18528,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18559,15 +18537,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18887,6 +18864,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18895,15 +18873,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19096,6 +19073,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19104,11 +19082,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19285,6 +19266,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19293,18 +19275,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19592,6 +19570,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19600,15 +19579,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19810,6 +19788,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19818,11 +19797,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20007,6 +19989,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20015,18 +19998,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py index e17fc60a6860..d85a850bd672 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6366,6 +6368,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6374,15 +6377,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6558,6 +6560,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6566,11 +6569,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6732,6 +6738,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6740,18 +6747,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6928,6 +6931,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6936,15 +6940,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7123,6 +7126,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7131,15 +7135,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7711,6 +7714,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7719,15 +7723,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7923,6 +7926,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7931,15 +7935,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8112,6 +8115,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8120,15 +8124,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8301,6 +8304,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8309,15 +8313,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8493,6 +8496,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8501,15 +8505,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8688,6 +8691,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8696,15 +8700,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8877,6 +8880,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8885,15 +8889,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9070,6 +9073,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9078,15 +9082,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9464,6 +9467,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9472,15 +9476,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9673,6 +9676,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9681,15 +9685,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9884,6 +9887,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9892,15 +9896,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10079,6 +10082,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10087,18 +10091,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10361,6 +10361,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10369,15 +10370,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10463,6 +10463,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10471,15 +10472,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10569,6 +10569,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10577,15 +10578,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10772,6 +10772,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10780,15 +10781,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10992,6 +10992,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11000,11 +11001,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11191,6 +11195,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11199,18 +11204,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11490,6 +11491,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11498,15 +11500,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11674,6 +11675,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11682,15 +11684,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11783,6 +11784,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11791,15 +11793,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11910,6 +11911,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11918,15 +11920,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12109,6 +12110,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12117,18 +12119,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12470,6 +12468,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12478,15 +12477,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12591,6 +12589,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12599,15 +12598,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12699,6 +12697,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12707,15 +12706,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12807,6 +12805,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12815,15 +12814,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12988,6 +12986,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12996,15 +12995,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13168,6 +13166,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13176,15 +13175,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13392,6 +13390,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13400,15 +13399,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13602,6 +13600,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13610,11 +13609,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13792,6 +13794,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13800,18 +13803,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14145,6 +14144,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14153,15 +14153,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14343,6 +14342,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14351,15 +14351,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14535,6 +14534,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14543,11 +14543,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14705,6 +14708,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14713,18 +14717,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14940,6 +14940,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14948,15 +14949,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15044,6 +15044,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15052,15 +15053,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15467,6 +15467,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15475,15 +15476,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15575,6 +15575,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15583,15 +15584,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15675,6 +15675,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15683,15 +15684,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15775,6 +15775,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15783,15 +15784,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15875,6 +15875,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15883,15 +15884,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15996,6 +15996,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16004,15 +16005,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16230,6 +16230,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16238,15 +16239,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16382,6 +16382,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16390,15 +16391,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16510,6 +16510,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16518,15 +16519,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16708,6 +16708,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16716,15 +16717,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18577,11 +18577,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19139,11 +19135,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19615,6 +19607,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19623,15 +19616,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19816,6 +19808,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19824,11 +19817,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19996,6 +19992,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20004,18 +20001,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20260,6 +20253,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20268,11 +20262,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20639,11 +20636,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21002,6 +20995,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21010,15 +21004,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21184,6 +21177,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21192,15 +21186,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21352,6 +21345,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21360,18 +21354,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21790,11 +21780,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21958,6 +21944,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21966,18 +21953,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22329,6 +22312,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22337,11 +22321,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22512,6 +22499,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22520,18 +22508,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22811,11 +22795,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23324,6 +23304,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23332,15 +23313,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23534,6 +23514,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23542,15 +23523,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23725,6 +23705,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23733,18 +23714,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24028,6 +24005,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24036,15 +24014,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24205,6 +24182,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24213,15 +24191,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24540,6 +24517,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24548,15 +24526,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24749,6 +24726,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24757,11 +24735,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24938,6 +24919,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24946,18 +24928,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25245,6 +25223,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25253,15 +25232,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25463,6 +25441,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25471,11 +25450,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25660,6 +25642,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25668,18 +25651,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py index fbea3fd3e1c9..688964283894 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,6 +1149,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1158,15 +1158,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1346,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1355,15 +1355,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1584,6 +1583,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1592,18 +1592,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1922,6 +1918,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1930,15 +1927,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2184,6 +2180,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2192,18 +2189,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2419,6 +2412,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2427,15 +2421,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2620,6 +2613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2628,15 +2622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2864,6 +2857,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2872,18 +2866,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,6 +3400,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3418,15 +3409,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3620,6 +3610,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3628,15 +3619,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3772,6 +3762,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3780,15 +3771,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3963,6 +3953,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3971,15 +3962,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4200,6 +4190,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4208,18 +4199,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4476,6 +4463,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4484,15 +4472,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4659,6 +4646,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4667,15 +4655,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py index 2d357b2d3d39..aae611587828 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2318,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,15 +2327,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2513,6 +2512,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2521,15 +2521,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,6 +2744,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2753,18 +2753,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3079,6 +3075,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3087,15 +3084,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3341,6 +3337,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3349,18 +3346,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,6 +3569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3584,15 +3578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3767,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,15 +3776,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4013,6 +4006,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4021,18 +4015,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,6 +4542,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4560,15 +4551,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,6 +4749,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4767,15 +4758,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4911,6 +4901,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4919,15 +4910,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5099,6 +5089,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5107,15 +5098,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5331,6 +5321,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5339,18 +5330,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5605,6 +5592,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5613,15 +5601,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5770,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,15 +5779,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/aio/operations/_operations.py index 0ff2ab0125ef..82c5a28b0c96 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,18 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -334,6 +333,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -342,11 +342,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -577,6 +580,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -585,18 +589,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -872,6 +872,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -880,18 +881,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,6 +1084,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1095,11 +1093,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1336,6 +1337,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1344,18 +1346,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,6 +1570,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1580,18 +1579,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1809,6 +1804,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1817,11 +1813,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,6 +2101,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2110,18 +2110,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2350,6 +2346,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2358,18 +2355,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2569,6 +2562,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2577,11 +2571,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2825,6 +2822,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2833,18 +2831,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3062,6 +3056,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3070,18 +3065,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3301,6 +3292,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3309,11 +3301,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3596,6 +3591,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3604,18 +3600,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3843,6 +3835,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3851,15 +3844,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/operations/_operations.py index 7b0a8ea369e7..00c13130dec8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_03/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1434,6 +1436,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1442,18 +1445,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1627,6 +1626,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1635,11 +1635,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1867,6 +1870,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1875,18 +1879,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,6 +2162,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2170,18 +2171,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,6 +2374,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2385,11 +2383,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2626,6 +2627,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2634,18 +2636,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2861,6 +2859,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2869,18 +2868,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3098,6 +3093,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3106,11 +3102,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3391,6 +3390,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3399,18 +3399,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3639,6 +3635,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3647,18 +3644,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3858,6 +3851,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3866,11 +3860,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4114,6 +4111,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4122,18 +4120,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4350,6 +4344,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4358,18 +4353,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4589,6 +4580,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4597,11 +4589,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4884,6 +4879,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4892,18 +4888,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5131,6 +5123,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5139,15 +5132,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/aio/operations/_operations.py index 4f4ae3f5f1d1..ff8c7052328c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -119,6 +121,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -127,18 +130,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -452,6 +451,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -460,15 +460,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -561,6 +560,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -569,15 +569,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -670,6 +669,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -678,15 +678,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -793,6 +792,7 @@ async def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -801,11 +801,14 @@ async def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1043,6 +1046,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1051,15 +1055,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1238,6 +1241,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1246,11 +1250,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1407,6 +1414,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1415,18 +1423,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1781,6 +1785,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1789,15 +1794,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1885,6 +1889,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1893,15 +1898,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2009,6 +2013,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2017,15 +2022,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2194,6 +2198,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2202,15 +2207,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2382,6 +2386,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2390,15 +2395,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2573,6 +2577,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2581,15 +2586,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2781,6 +2785,7 @@ async def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2789,15 +2794,14 @@ async def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/operations/_operations.py index e8a712582091..5224398f794e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_04_04/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1054,6 +1056,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1062,18 +1065,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1386,6 +1385,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1394,15 +1394,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1495,6 +1494,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1503,15 +1503,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1604,6 +1603,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1612,15 +1612,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1727,6 +1726,7 @@ def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1735,11 +1735,14 @@ def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,6 +1979,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1984,15 +1988,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2171,6 +2174,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2179,11 +2183,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2338,6 +2345,7 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2346,18 +2354,14 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2706,6 +2710,7 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2714,15 +2719,14 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2806,6 +2810,7 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2814,15 +2819,14 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2928,6 +2932,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2936,15 +2941,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3113,6 +3117,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3121,15 +3126,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3301,6 +3305,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3309,15 +3314,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3492,6 +3496,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3500,15 +3505,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3700,6 +3704,7 @@ def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3708,15 +3713,14 @@ def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/aio/operations/_operations.py index 6549ba4a7e0e..f4b876117fec 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,6 +1149,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1158,15 +1158,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1346,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1355,15 +1355,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1584,6 +1583,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1592,18 +1592,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1922,6 +1918,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1930,15 +1927,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2184,6 +2180,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2192,18 +2189,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2419,6 +2412,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2427,15 +2421,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2620,6 +2613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2628,15 +2622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2864,6 +2857,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2872,18 +2866,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,6 +3400,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3418,15 +3409,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3620,6 +3610,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3628,15 +3619,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3772,6 +3762,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3780,15 +3771,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3963,6 +3953,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3971,15 +3962,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4200,6 +4190,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4208,18 +4199,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4476,6 +4463,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4484,15 +4472,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4659,6 +4646,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4667,15 +4655,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/operations/_operations.py index b0ff287333f7..f178377cb6fa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_07_02/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2318,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,15 +2327,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2513,6 +2512,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2521,15 +2521,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,6 +2744,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2753,18 +2753,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3079,6 +3075,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3087,15 +3084,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3341,6 +3337,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3349,18 +3346,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,6 +3569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3584,15 +3578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3767,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,15 +3776,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4013,6 +4006,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4021,18 +4015,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,6 +4542,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4560,15 +4551,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,6 +4749,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4767,15 +4758,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4911,6 +4901,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4919,15 +4910,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5099,6 +5089,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5107,15 +5098,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5331,6 +5321,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5339,18 +5330,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5605,6 +5592,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5613,15 +5601,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5770,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,15 +5779,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/aio/operations/_operations.py index 5196b87f75b4..9ae527031415 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -665,6 +667,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -673,15 +676,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -857,6 +859,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -865,11 +868,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1031,6 +1037,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1039,18 +1046,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1227,6 +1230,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1235,15 +1239,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1422,6 +1425,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1430,15 +1434,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2010,6 +2013,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2018,15 +2022,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2222,6 +2225,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2230,15 +2234,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2411,6 +2414,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2419,15 +2423,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2600,6 +2603,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2608,15 +2612,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2792,6 +2795,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2800,15 +2804,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2987,6 +2990,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2995,15 +2999,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3176,6 +3179,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3184,15 +3188,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3369,6 +3372,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3377,15 +3381,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3763,6 +3766,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3771,15 +3775,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3972,6 +3975,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3980,15 +3984,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4183,6 +4186,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4191,15 +4195,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4378,6 +4381,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4386,18 +4390,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4662,6 +4662,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4670,15 +4671,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4766,6 +4766,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4774,15 +4775,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4872,6 +4872,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4880,15 +4881,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5075,6 +5075,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5083,15 +5084,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5295,6 +5295,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5303,11 +5304,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5494,6 +5498,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5502,18 +5507,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5793,6 +5794,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5801,15 +5803,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5977,6 +5978,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5985,15 +5987,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6086,6 +6087,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6094,15 +6096,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6213,6 +6214,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6221,15 +6223,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6412,6 +6413,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6420,18 +6422,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6773,6 +6771,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6781,15 +6780,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6894,6 +6892,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6902,15 +6901,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7002,6 +7000,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7010,15 +7009,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7110,6 +7108,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7118,15 +7117,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7291,6 +7289,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7299,15 +7298,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7471,6 +7469,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7479,15 +7478,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7698,6 +7696,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7706,15 +7705,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7908,6 +7906,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7916,11 +7915,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8098,6 +8100,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8106,18 +8109,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8452,6 +8451,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8460,15 +8460,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8650,6 +8649,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8658,15 +8658,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8845,6 +8844,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8853,11 +8853,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9018,6 +9021,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9026,18 +9030,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9253,6 +9253,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9261,15 +9262,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9359,6 +9359,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9367,15 +9368,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9785,6 +9785,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9793,15 +9794,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9893,6 +9893,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9901,15 +9902,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9993,6 +9993,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10001,15 +10002,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10093,6 +10093,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10101,15 +10102,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10193,6 +10193,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10201,15 +10202,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10314,6 +10314,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10322,15 +10323,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10550,6 +10550,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10558,15 +10559,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10706,6 +10706,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10714,15 +10715,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10834,6 +10834,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10842,15 +10843,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11032,6 +11032,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11040,15 +11041,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12909,11 +12909,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13471,11 +13467,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13951,6 +13943,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13959,15 +13952,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14155,6 +14147,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14163,11 +14156,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14338,6 +14334,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14346,18 +14343,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14603,6 +14596,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14611,11 +14605,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14982,11 +14979,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15347,6 +15340,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15355,15 +15349,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15529,6 +15522,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15537,15 +15531,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15697,6 +15690,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15705,18 +15699,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16135,11 +16125,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16303,6 +16289,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16311,18 +16298,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16674,6 +16657,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16682,11 +16666,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16857,6 +16844,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16865,18 +16853,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17156,11 +17140,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17669,6 +17649,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17677,15 +17658,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17879,6 +17859,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17887,15 +17868,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18070,6 +18050,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18078,18 +18059,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18373,6 +18350,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18381,15 +18359,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18551,6 +18528,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18559,15 +18537,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18887,6 +18864,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18895,15 +18873,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19096,6 +19073,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19104,11 +19082,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19285,6 +19266,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19293,18 +19275,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19592,6 +19570,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19600,15 +19579,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19810,6 +19788,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19818,11 +19797,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20007,6 +19989,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20015,18 +19998,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/operations/_operations.py index de72ebe5c057..a03d616b3c4f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6366,6 +6368,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6374,15 +6377,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6558,6 +6560,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6566,11 +6569,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6732,6 +6738,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6740,18 +6747,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6928,6 +6931,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6936,15 +6940,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7123,6 +7126,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7131,15 +7135,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7711,6 +7714,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7719,15 +7723,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7923,6 +7926,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7931,15 +7935,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8112,6 +8115,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8120,15 +8124,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8301,6 +8304,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8309,15 +8313,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8493,6 +8496,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8501,15 +8505,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8688,6 +8691,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8696,15 +8700,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8877,6 +8880,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8885,15 +8889,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9070,6 +9073,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9078,15 +9082,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9464,6 +9467,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9472,15 +9476,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9673,6 +9676,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9681,15 +9685,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9884,6 +9887,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9892,15 +9896,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10079,6 +10082,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10087,18 +10091,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10361,6 +10361,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10369,15 +10370,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10463,6 +10463,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10471,15 +10472,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10569,6 +10569,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10577,15 +10578,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10772,6 +10772,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10780,15 +10781,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10992,6 +10992,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11000,11 +11001,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11191,6 +11195,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11199,18 +11204,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11490,6 +11491,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11498,15 +11500,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11674,6 +11675,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11682,15 +11684,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11783,6 +11784,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11791,15 +11793,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11910,6 +11911,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11918,15 +11920,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12109,6 +12110,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12117,18 +12119,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12470,6 +12468,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12478,15 +12477,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12591,6 +12589,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12599,15 +12598,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12699,6 +12697,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12707,15 +12706,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12807,6 +12805,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12815,15 +12814,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12988,6 +12986,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12996,15 +12995,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13168,6 +13166,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13176,15 +13175,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13392,6 +13390,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13400,15 +13399,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13602,6 +13600,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13610,11 +13609,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13792,6 +13794,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13800,18 +13803,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14145,6 +14144,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14153,15 +14153,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14343,6 +14342,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14351,15 +14351,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14535,6 +14534,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14543,11 +14543,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14705,6 +14708,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14713,18 +14717,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14940,6 +14940,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14948,15 +14949,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15044,6 +15044,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15052,15 +15053,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15467,6 +15467,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15475,15 +15476,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15575,6 +15575,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15583,15 +15584,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15675,6 +15675,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15683,15 +15684,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15775,6 +15775,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15783,15 +15784,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15875,6 +15875,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15883,15 +15884,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15996,6 +15996,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16004,15 +16005,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16230,6 +16230,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16238,15 +16239,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16382,6 +16382,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16390,15 +16391,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16510,6 +16510,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16518,15 +16519,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16708,6 +16708,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16716,15 +16717,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18577,11 +18577,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19139,11 +19135,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19615,6 +19607,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19623,15 +19616,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19816,6 +19808,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19824,11 +19817,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19996,6 +19992,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20004,18 +20001,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20260,6 +20253,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20268,11 +20262,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20639,11 +20636,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21002,6 +20995,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21010,15 +21004,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21184,6 +21177,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21192,15 +21186,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21352,6 +21345,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21360,18 +21354,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21790,11 +21780,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21958,6 +21944,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21966,18 +21953,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22329,6 +22312,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22337,11 +22321,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22512,6 +22499,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22520,18 +22508,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22811,11 +22795,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23324,6 +23304,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23332,15 +23313,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23534,6 +23514,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23542,15 +23523,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23725,6 +23705,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23733,18 +23714,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24028,6 +24005,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24036,15 +24014,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24205,6 +24182,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24213,15 +24191,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24540,6 +24517,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24548,15 +24526,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24749,6 +24726,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24757,11 +24735,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24938,6 +24919,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24946,18 +24928,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25245,6 +25223,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25253,15 +25232,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25463,6 +25441,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25471,11 +25450,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25660,6 +25642,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25668,18 +25651,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/aio/operations/_operations.py index c07c4091110c..2829efdcbd70 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,18 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -334,6 +333,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -342,11 +342,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -577,6 +580,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -585,18 +589,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -872,6 +872,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -880,18 +881,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,6 +1084,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1095,11 +1093,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1336,6 +1337,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1344,18 +1346,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,6 +1570,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1580,18 +1579,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1809,6 +1804,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1817,11 +1813,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,6 +2101,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2110,18 +2110,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2350,6 +2346,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2358,18 +2355,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2569,6 +2562,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2577,11 +2571,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2825,6 +2822,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2833,18 +2831,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3062,6 +3056,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3070,18 +3065,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3301,6 +3292,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3309,11 +3301,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3596,6 +3591,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3604,18 +3600,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3843,6 +3835,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3851,15 +3844,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/operations/_operations.py index 997139e6adf2..c1f0f5d9489e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_08_03/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1434,6 +1436,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1442,18 +1445,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1627,6 +1626,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1635,11 +1635,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1867,6 +1870,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1875,18 +1879,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,6 +2162,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2170,18 +2171,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,6 +2374,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2385,11 +2383,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2626,6 +2627,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2634,18 +2636,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2861,6 +2859,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2869,18 +2868,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3098,6 +3093,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3106,11 +3102,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3391,6 +3390,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3399,18 +3399,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3639,6 +3635,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3647,18 +3644,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3858,6 +3851,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3866,11 +3860,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4114,6 +4111,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4122,18 +4120,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4350,6 +4344,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4358,18 +4353,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4589,6 +4580,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4597,11 +4589,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4884,6 +4879,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4892,18 +4888,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5131,6 +5123,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5139,15 +5132,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py index e665f9d97b4f..1269f7b25db1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -119,6 +121,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -127,18 +130,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -452,6 +451,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -460,15 +460,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -561,6 +560,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -569,15 +569,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -670,6 +669,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -678,15 +678,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -793,6 +792,7 @@ async def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -801,11 +801,14 @@ async def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1043,6 +1046,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1051,15 +1055,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1238,6 +1241,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1246,11 +1250,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1407,6 +1414,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1415,18 +1423,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1781,6 +1785,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1789,15 +1794,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1885,6 +1889,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1893,15 +1898,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2009,6 +2013,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2017,15 +2022,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2194,6 +2198,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2202,15 +2207,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2382,6 +2386,7 @@ async def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2390,15 +2395,14 @@ async def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2573,6 +2577,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2581,15 +2586,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2781,6 +2785,7 @@ async def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2789,15 +2794,14 @@ async def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py index 430f0c7088cc..3482f2468875 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1054,6 +1056,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1062,18 +1065,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1386,6 +1385,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1394,15 +1394,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1495,6 +1494,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1503,15 +1503,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1604,6 +1603,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1612,15 +1612,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1727,6 +1726,7 @@ def get_remote_desktop_file( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1735,11 +1735,14 @@ def get_remote_desktop_file( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1976,6 +1979,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1984,15 +1988,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2171,6 +2174,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2179,11 +2183,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2338,6 +2345,7 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2346,18 +2354,14 @@ def _delete_initial(self, resource_group_name: str, cloud_service_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2706,6 +2710,7 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2714,15 +2719,14 @@ def _start_initial(self, resource_group_name: str, cloud_service_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2806,6 +2810,7 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2814,15 +2819,14 @@ def _power_off_initial(self, resource_group_name: str, cloud_service_name: str, response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2928,6 +2932,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2936,15 +2941,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3113,6 +3117,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3121,15 +3126,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3301,6 +3305,7 @@ def _rebuild_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3309,15 +3314,14 @@ def _rebuild_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3492,6 +3496,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3500,15 +3505,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3700,6 +3704,7 @@ def _walk_update_domain_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3708,15 +3713,14 @@ def _walk_update_domain_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/aio/operations/_operations.py index bdac41a42bb7..370549be70b1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -665,6 +667,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -673,15 +676,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -857,6 +859,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -865,11 +868,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1031,6 +1037,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1039,18 +1046,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1227,6 +1230,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1235,15 +1239,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1422,6 +1425,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1430,15 +1434,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2010,6 +2013,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2018,15 +2022,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2222,6 +2225,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2230,15 +2234,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2411,6 +2414,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2419,15 +2423,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2600,6 +2603,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2608,15 +2612,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2792,6 +2795,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2800,15 +2804,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2987,6 +2990,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2995,15 +2999,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3176,6 +3179,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3184,15 +3188,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3369,6 +3372,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3377,15 +3381,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3763,6 +3766,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3771,15 +3775,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3972,6 +3975,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3980,15 +3984,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4183,6 +4186,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4191,15 +4195,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4378,6 +4381,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4386,18 +4390,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4662,6 +4662,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4670,15 +4671,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4766,6 +4766,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4774,15 +4775,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4872,6 +4872,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4880,15 +4881,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5075,6 +5075,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5083,15 +5084,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5295,6 +5295,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5303,11 +5304,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5494,6 +5498,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5502,18 +5507,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5793,6 +5794,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5801,15 +5803,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5977,6 +5978,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5985,15 +5987,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6086,6 +6087,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6094,15 +6096,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6213,6 +6214,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6221,15 +6223,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6412,6 +6413,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6420,18 +6422,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6773,6 +6771,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6781,15 +6780,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6894,6 +6892,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6902,15 +6901,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7002,6 +7000,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7010,15 +7009,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7110,6 +7108,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7118,15 +7117,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7291,6 +7289,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7299,15 +7298,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7471,6 +7469,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7479,15 +7478,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7698,6 +7696,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7706,15 +7705,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7908,6 +7906,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7916,11 +7915,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8098,6 +8100,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8106,18 +8109,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8452,6 +8451,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8460,15 +8460,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8650,6 +8649,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8658,15 +8658,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8845,6 +8844,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8853,11 +8853,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9018,6 +9021,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9026,18 +9030,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9253,6 +9253,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9261,15 +9262,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9359,6 +9359,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9367,15 +9368,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9785,6 +9785,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9793,15 +9794,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9893,6 +9893,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9901,15 +9902,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9993,6 +9993,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10001,15 +10002,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10093,6 +10093,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10101,15 +10102,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10193,6 +10193,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10201,15 +10202,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10314,6 +10314,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10322,15 +10323,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10565,6 +10565,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10573,15 +10574,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10721,6 +10721,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10729,15 +10730,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10849,6 +10849,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10857,15 +10858,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11047,6 +11047,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11055,15 +11056,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12924,11 +12924,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13486,11 +13482,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13966,6 +13958,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13974,15 +13967,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14170,6 +14162,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14178,11 +14171,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14353,6 +14349,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14361,18 +14358,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14618,6 +14611,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14626,11 +14620,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14997,11 +14994,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15362,6 +15355,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15370,15 +15364,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15544,6 +15537,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15552,15 +15546,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15712,6 +15705,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15720,18 +15714,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16150,11 +16140,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16318,6 +16304,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16326,18 +16313,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16689,6 +16672,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16697,11 +16681,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16872,6 +16859,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16880,18 +16868,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17171,11 +17155,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17684,6 +17664,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17692,15 +17673,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17894,6 +17874,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17902,15 +17883,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18085,6 +18065,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18093,18 +18074,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18388,6 +18365,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18396,15 +18374,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18566,6 +18543,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18574,15 +18552,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18902,6 +18879,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18910,15 +18888,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19111,6 +19088,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19119,11 +19097,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19300,6 +19281,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19308,18 +19290,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19607,6 +19585,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19615,15 +19594,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19825,6 +19803,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19833,11 +19812,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20022,6 +20004,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20030,18 +20013,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/operations/_operations.py index a7d1fdfd3c9d..93ae1ca48153 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_11_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6366,6 +6368,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6374,15 +6377,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6558,6 +6560,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6566,11 +6569,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6732,6 +6738,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6740,18 +6747,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6928,6 +6931,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6936,15 +6940,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7123,6 +7126,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7131,15 +7135,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7711,6 +7714,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7719,15 +7723,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7923,6 +7926,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7931,15 +7935,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8112,6 +8115,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8120,15 +8124,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8301,6 +8304,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8309,15 +8313,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8493,6 +8496,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8501,15 +8505,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8688,6 +8691,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8696,15 +8700,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8877,6 +8880,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8885,15 +8889,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9070,6 +9073,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9078,15 +9082,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9464,6 +9467,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9472,15 +9476,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9673,6 +9676,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9681,15 +9685,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9884,6 +9887,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9892,15 +9896,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10079,6 +10082,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10087,18 +10091,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10361,6 +10361,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10369,15 +10370,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10463,6 +10463,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10471,15 +10472,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10569,6 +10569,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10577,15 +10578,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10772,6 +10772,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10780,15 +10781,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10992,6 +10992,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11000,11 +11001,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11191,6 +11195,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11199,18 +11204,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11490,6 +11491,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11498,15 +11500,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11674,6 +11675,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11682,15 +11684,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11783,6 +11784,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11791,15 +11793,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11910,6 +11911,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11918,15 +11920,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12109,6 +12110,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12117,18 +12119,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12470,6 +12468,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12478,15 +12477,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12591,6 +12589,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12599,15 +12598,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12699,6 +12697,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12707,15 +12706,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12807,6 +12805,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12815,15 +12814,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12988,6 +12986,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12996,15 +12995,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13168,6 +13166,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13176,15 +13175,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13392,6 +13390,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13400,15 +13399,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13602,6 +13600,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13610,11 +13609,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13792,6 +13794,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13800,18 +13803,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14145,6 +14144,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14153,15 +14153,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14343,6 +14342,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14351,15 +14351,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14535,6 +14534,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14543,11 +14543,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14705,6 +14708,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14713,18 +14717,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14940,6 +14940,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14948,15 +14949,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15044,6 +15044,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15052,15 +15053,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15467,6 +15467,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15475,15 +15476,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15575,6 +15575,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15583,15 +15584,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15675,6 +15675,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15683,15 +15684,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15775,6 +15775,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15783,15 +15784,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15875,6 +15875,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15883,15 +15884,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15996,6 +15996,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16004,15 +16005,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16245,6 +16245,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16253,15 +16254,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16397,6 +16397,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16405,15 +16406,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16525,6 +16525,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16533,15 +16534,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16723,6 +16723,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16731,15 +16732,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18592,11 +18592,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19154,11 +19150,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19630,6 +19622,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19638,15 +19631,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19831,6 +19823,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19839,11 +19832,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20011,6 +20007,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20019,18 +20016,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20275,6 +20268,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20283,11 +20277,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20654,11 +20651,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21017,6 +21010,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21025,15 +21019,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21199,6 +21192,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21207,15 +21201,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21367,6 +21360,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21375,18 +21369,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21805,11 +21795,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21973,6 +21959,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21981,18 +21968,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22344,6 +22327,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22352,11 +22336,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22527,6 +22514,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22535,18 +22523,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22826,11 +22810,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23339,6 +23319,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23347,15 +23328,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23549,6 +23529,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23557,15 +23538,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23740,6 +23720,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23748,18 +23729,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24043,6 +24020,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24051,15 +24029,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24220,6 +24197,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24228,15 +24206,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24555,6 +24532,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24563,15 +24541,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24764,6 +24741,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24772,11 +24750,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24953,6 +24934,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24961,18 +24943,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25260,6 +25238,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25268,15 +25247,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25478,6 +25456,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25486,11 +25465,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25675,6 +25657,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25683,18 +25666,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/aio/operations/_operations.py index 7c76b6c11e88..fc973c055ba1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,6 +1149,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1158,15 +1158,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1346,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1355,15 +1355,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1584,6 +1583,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1592,18 +1592,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1922,6 +1918,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1930,15 +1927,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2184,6 +2180,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2192,18 +2189,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2419,6 +2412,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2427,15 +2421,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2620,6 +2613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2628,15 +2622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2864,6 +2857,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2872,18 +2866,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,6 +3400,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3418,15 +3409,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3620,6 +3610,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3628,15 +3619,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3772,6 +3762,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3780,15 +3771,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3963,6 +3953,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3971,15 +3962,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4200,6 +4190,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4208,18 +4199,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4476,6 +4463,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4484,15 +4472,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4659,6 +4646,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4667,15 +4655,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/operations/_operations.py index d742bcc1a0b1..62a5d71fe79c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_01_02/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2318,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,15 +2327,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2513,6 +2512,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2521,15 +2521,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,6 +2744,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2753,18 +2753,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3079,6 +3075,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3087,15 +3084,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3341,6 +3337,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3349,18 +3346,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,6 +3569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3584,15 +3578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3767,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,15 +3776,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4013,6 +4006,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4021,18 +4015,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,6 +4542,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4560,15 +4551,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,6 +4749,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4767,15 +4758,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4911,6 +4901,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4919,15 +4910,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5099,6 +5089,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5107,15 +5098,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5331,6 +5321,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5339,18 +5330,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5605,6 +5592,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5613,15 +5601,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5770,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,15 +5779,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/aio/operations/_operations.py index f089d1efcaf0..f3e67330113c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -667,6 +669,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -675,15 +678,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -859,6 +861,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -867,11 +870,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1033,6 +1039,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1041,18 +1048,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1232,6 +1235,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1240,15 +1244,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1444,6 +1447,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1452,15 +1456,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2032,6 +2035,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2040,15 +2044,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2244,6 +2247,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2252,15 +2256,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2433,6 +2436,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2441,15 +2445,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2603,6 +2606,7 @@ async def _reapply_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2611,18 +2615,18 @@ async def _reapply_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2732,6 +2736,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2740,15 +2745,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2924,6 +2928,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2932,15 +2937,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3119,6 +3123,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3127,15 +3132,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3308,6 +3312,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3316,15 +3321,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3501,6 +3505,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3509,15 +3514,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3895,6 +3899,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3903,15 +3908,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4104,6 +4108,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4112,15 +4117,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4315,6 +4319,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4323,15 +4328,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4510,6 +4514,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4518,18 +4523,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4794,6 +4795,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4802,15 +4804,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4898,6 +4899,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4906,15 +4908,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5004,6 +5005,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5012,15 +5014,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5207,6 +5208,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5215,15 +5217,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5427,6 +5428,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5435,11 +5437,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5626,6 +5631,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5634,18 +5640,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5925,6 +5927,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5933,15 +5936,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6109,6 +6111,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6117,15 +6120,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6218,6 +6220,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6226,15 +6229,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6345,6 +6347,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6353,15 +6356,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6544,6 +6546,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6552,18 +6555,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6905,6 +6904,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6913,15 +6913,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7026,6 +7025,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7034,15 +7034,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7134,6 +7133,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7142,15 +7142,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7242,6 +7241,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7250,15 +7250,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7422,6 +7421,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7430,15 +7430,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7602,6 +7601,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7610,15 +7610,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7829,6 +7828,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7837,15 +7837,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8039,6 +8038,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8047,11 +8047,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8229,6 +8232,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8237,18 +8241,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8583,6 +8583,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8591,15 +8592,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8781,6 +8781,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8789,15 +8790,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8976,6 +8976,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8984,11 +8985,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9149,6 +9153,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9157,18 +9162,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9384,6 +9385,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9392,15 +9394,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9490,6 +9491,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9498,15 +9500,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9936,6 +9937,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9944,15 +9946,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10044,6 +10045,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10052,15 +10054,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10144,6 +10145,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10152,15 +10154,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10244,6 +10245,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10252,15 +10254,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10344,6 +10345,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10352,15 +10354,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10465,6 +10466,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10473,15 +10475,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10715,6 +10716,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10723,15 +10725,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10871,6 +10872,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10879,15 +10881,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10999,6 +11000,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11007,15 +11009,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11197,6 +11198,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11205,15 +11207,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13074,11 +13075,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13636,11 +13633,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14116,6 +14109,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14124,15 +14118,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14320,6 +14313,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14328,11 +14322,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14503,6 +14500,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14511,18 +14509,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14768,6 +14762,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14776,11 +14771,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15234,11 +15232,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15599,6 +15593,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15607,15 +15602,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15781,6 +15775,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15789,15 +15784,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15949,6 +15943,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15957,18 +15952,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16387,11 +16378,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16555,6 +16542,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16563,18 +16551,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16926,6 +16910,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16934,11 +16919,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17109,6 +17097,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17117,18 +17106,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17408,11 +17393,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17921,6 +17902,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17929,15 +17911,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18131,6 +18112,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18139,15 +18121,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18322,6 +18303,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18330,18 +18312,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18625,6 +18603,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18633,15 +18612,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18803,6 +18781,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18811,15 +18790,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19139,6 +19117,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19147,15 +19126,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19348,6 +19326,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19356,11 +19335,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19537,6 +19519,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19545,18 +19528,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19844,6 +19823,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19852,15 +19832,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20062,6 +20041,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20070,11 +20050,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20259,6 +20242,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20267,18 +20251,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/operations/_operations.py index c3b6b3459f5d..644516991973 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_03_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6450,6 +6452,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6458,15 +6461,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6642,6 +6644,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6650,11 +6653,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6816,6 +6822,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6824,18 +6831,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7015,6 +7018,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7023,15 +7027,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7227,6 +7230,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7235,15 +7239,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7815,6 +7818,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7823,15 +7827,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8027,6 +8030,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8035,15 +8039,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8216,6 +8219,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8224,15 +8228,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8384,6 +8387,7 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8392,18 +8396,18 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8511,6 +8515,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8519,15 +8524,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8703,6 +8707,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8711,15 +8716,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8898,6 +8902,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8906,15 +8911,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9087,6 +9091,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9095,15 +9100,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9280,6 +9284,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9288,15 +9293,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9674,6 +9678,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9682,15 +9687,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9883,6 +9887,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9891,15 +9896,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10094,6 +10098,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10102,15 +10107,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10289,6 +10293,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10297,18 +10302,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10571,6 +10572,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10579,15 +10581,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10673,6 +10674,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10681,15 +10683,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10779,6 +10780,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10787,15 +10789,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10982,6 +10983,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10990,15 +10992,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11202,6 +11203,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11210,11 +11212,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11401,6 +11406,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11409,18 +11415,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11700,6 +11702,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11708,15 +11711,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11884,6 +11886,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11892,15 +11895,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11993,6 +11995,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12001,15 +12004,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12120,6 +12122,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12128,15 +12131,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12319,6 +12321,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12327,18 +12330,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12680,6 +12679,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12688,15 +12688,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12801,6 +12800,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12809,15 +12809,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12909,6 +12908,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12917,15 +12917,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13017,6 +13016,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13025,15 +13025,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13197,6 +13196,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13205,15 +13205,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13377,6 +13376,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13385,15 +13385,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13601,6 +13600,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13609,15 +13609,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13811,6 +13810,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13819,11 +13819,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14001,6 +14004,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14009,18 +14013,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14354,6 +14354,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14362,15 +14363,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14552,6 +14552,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14560,15 +14561,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14744,6 +14744,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14752,11 +14753,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14914,6 +14918,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14922,18 +14927,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15149,6 +15150,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15157,15 +15159,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15253,6 +15254,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15261,15 +15263,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15696,6 +15697,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15704,15 +15706,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15804,6 +15805,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15812,15 +15814,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15904,6 +15905,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15912,15 +15914,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16004,6 +16005,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16012,15 +16014,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16104,6 +16105,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16112,15 +16114,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16225,6 +16226,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16233,15 +16235,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16473,6 +16474,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16481,15 +16483,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16625,6 +16626,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16633,15 +16635,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16753,6 +16754,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16761,15 +16763,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16951,6 +16952,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16959,15 +16961,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18820,11 +18821,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19382,11 +19379,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19858,6 +19851,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19866,15 +19860,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20059,6 +20052,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20067,11 +20061,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20239,6 +20236,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20247,18 +20245,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20503,6 +20497,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20511,11 +20506,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20969,11 +20967,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21332,6 +21326,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21340,15 +21335,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21514,6 +21508,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21522,15 +21517,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21682,6 +21676,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21690,18 +21685,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22120,11 +22111,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22288,6 +22275,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22296,18 +22284,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22659,6 +22643,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22667,11 +22652,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22842,6 +22830,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22850,18 +22839,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23141,11 +23126,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23654,6 +23635,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23662,15 +23644,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23864,6 +23845,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23872,15 +23854,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24055,6 +24036,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24063,18 +24045,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24358,6 +24336,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24366,15 +24345,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24535,6 +24513,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24543,15 +24522,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24870,6 +24848,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24878,15 +24857,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25079,6 +25057,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25087,11 +25066,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25268,6 +25250,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25276,18 +25259,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25575,6 +25554,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25583,15 +25563,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25793,6 +25772,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25801,11 +25781,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25990,6 +25973,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25998,18 +25982,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py index 1ce27053e286..7a986da574cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,6 +1149,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1158,15 +1158,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1346,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1355,15 +1355,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1584,6 +1583,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1592,18 +1592,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1922,6 +1918,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1930,15 +1927,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2184,6 +2180,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2192,18 +2189,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2419,6 +2412,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2427,15 +2421,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2620,6 +2613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2628,15 +2622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2864,6 +2857,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2872,18 +2866,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,6 +3400,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3418,15 +3409,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3620,6 +3610,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3628,15 +3619,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3772,6 +3762,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3780,15 +3771,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3963,6 +3953,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3971,15 +3962,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4200,6 +4190,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4208,18 +4199,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4476,6 +4463,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4484,15 +4472,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4659,6 +4646,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4667,15 +4655,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py index c94188d6aabf..9a4abb6eaf91 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2318,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,15 +2327,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2513,6 +2512,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2521,15 +2521,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,6 +2744,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2753,18 +2753,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3079,6 +3075,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3087,15 +3084,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3341,6 +3337,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3349,18 +3346,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,6 +3569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3584,15 +3578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3767,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,15 +3776,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4013,6 +4006,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4021,18 +4015,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,6 +4542,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4560,15 +4551,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,6 +4749,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4767,15 +4758,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4911,6 +4901,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4919,15 +4910,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5099,6 +5089,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5107,15 +5098,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5331,6 +5321,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5339,18 +5330,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5605,6 +5592,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5613,15 +5601,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5770,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,15 +5779,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/aio/operations/_operations.py index 28ca7230982f..0caa3d4b0036 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -667,6 +669,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -675,15 +678,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -859,6 +861,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -867,11 +870,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1033,6 +1039,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1041,18 +1048,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1232,6 +1235,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1240,15 +1244,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1444,6 +1447,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1452,15 +1456,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2032,6 +2035,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2040,15 +2044,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2244,6 +2247,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2252,15 +2256,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2433,6 +2436,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2441,15 +2445,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2603,6 +2606,7 @@ async def _reapply_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2611,18 +2615,18 @@ async def _reapply_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2732,6 +2736,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2740,15 +2745,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2924,6 +2928,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2932,15 +2937,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3119,6 +3123,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3127,15 +3132,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3308,6 +3312,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3316,15 +3321,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3501,6 +3505,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3509,15 +3514,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3895,6 +3899,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3903,15 +3908,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4104,6 +4108,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4112,15 +4117,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4315,6 +4319,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4323,15 +4328,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4510,6 +4514,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4518,18 +4523,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4794,6 +4795,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4802,15 +4804,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4898,6 +4899,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4906,15 +4908,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5004,6 +5005,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5012,15 +5014,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5207,6 +5208,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5215,15 +5217,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5427,6 +5428,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5435,11 +5437,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5626,6 +5631,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5634,18 +5640,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5925,6 +5927,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5933,15 +5936,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6109,6 +6111,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6117,15 +6120,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6218,6 +6220,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6226,15 +6229,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6345,6 +6347,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6353,15 +6356,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6544,6 +6546,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6552,18 +6555,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6905,6 +6904,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6913,15 +6913,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7026,6 +7025,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7034,15 +7034,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7134,6 +7133,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7142,15 +7142,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7242,6 +7241,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7250,15 +7250,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7422,6 +7421,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7430,15 +7430,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7602,6 +7601,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7610,15 +7610,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7829,6 +7828,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7837,15 +7837,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8039,6 +8038,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8047,11 +8047,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8229,6 +8232,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8237,18 +8241,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8583,6 +8583,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8591,15 +8592,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8781,6 +8781,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8789,15 +8790,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8976,6 +8976,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8984,11 +8985,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9149,6 +9153,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9157,18 +9162,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9384,6 +9385,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9392,15 +9394,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9490,6 +9491,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9498,15 +9500,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9936,6 +9937,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9944,15 +9946,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10044,6 +10045,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10052,15 +10054,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10144,6 +10145,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10152,15 +10154,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10244,6 +10245,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10252,15 +10254,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10344,6 +10345,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10352,15 +10354,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10465,6 +10466,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10473,15 +10475,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10715,6 +10716,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10723,15 +10725,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10871,6 +10872,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10879,15 +10881,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10999,6 +11000,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11007,15 +11009,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11197,6 +11198,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11205,15 +11207,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13074,11 +13075,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13636,11 +13633,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14116,6 +14109,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14124,15 +14118,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14320,6 +14313,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14328,11 +14322,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14503,6 +14500,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14511,18 +14509,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14768,6 +14762,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14776,11 +14771,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15234,11 +15232,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15599,6 +15593,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15607,15 +15602,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15781,6 +15775,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15789,15 +15784,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15949,6 +15943,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15957,18 +15952,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16388,11 +16379,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16556,6 +16543,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16564,18 +16552,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16927,6 +16911,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16935,11 +16920,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17110,6 +17098,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17118,18 +17107,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17409,11 +17394,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17922,6 +17903,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17930,15 +17912,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18132,6 +18113,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18140,15 +18122,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18323,6 +18304,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18331,18 +18313,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18626,6 +18604,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18634,15 +18613,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18804,6 +18782,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18812,15 +18791,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19140,6 +19118,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19148,15 +19127,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19349,6 +19327,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19357,11 +19336,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19538,6 +19520,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19546,18 +19529,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19845,6 +19824,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19853,15 +19833,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20063,6 +20042,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20071,11 +20051,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20260,6 +20243,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20268,18 +20252,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/operations/_operations.py index e957decf90ee..de24b0fc55f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6450,6 +6452,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6458,15 +6461,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6642,6 +6644,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6650,11 +6653,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6816,6 +6822,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6824,18 +6831,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7015,6 +7018,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7023,15 +7027,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7227,6 +7230,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7235,15 +7239,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7815,6 +7818,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7823,15 +7827,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8027,6 +8030,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8035,15 +8039,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8216,6 +8219,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8224,15 +8228,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8384,6 +8387,7 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8392,18 +8396,18 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8511,6 +8515,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8519,15 +8524,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8703,6 +8707,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8711,15 +8716,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8898,6 +8902,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8906,15 +8911,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9087,6 +9091,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9095,15 +9100,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9280,6 +9284,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9288,15 +9293,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9674,6 +9678,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9682,15 +9687,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9883,6 +9887,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9891,15 +9896,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10094,6 +10098,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10102,15 +10107,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10289,6 +10293,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10297,18 +10302,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10571,6 +10572,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10579,15 +10581,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10673,6 +10674,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10681,15 +10683,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10779,6 +10780,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10787,15 +10789,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10982,6 +10983,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10990,15 +10992,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11202,6 +11203,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11210,11 +11212,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11401,6 +11406,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11409,18 +11415,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11700,6 +11702,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11708,15 +11711,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11884,6 +11886,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11892,15 +11895,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11993,6 +11995,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12001,15 +12004,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12120,6 +12122,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12128,15 +12131,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12319,6 +12321,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12327,18 +12330,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12680,6 +12679,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12688,15 +12688,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12801,6 +12800,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12809,15 +12809,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12909,6 +12908,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12917,15 +12917,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13017,6 +13016,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13025,15 +13025,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13197,6 +13196,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13205,15 +13205,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13377,6 +13376,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13385,15 +13385,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13601,6 +13600,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13609,15 +13609,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13811,6 +13810,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13819,11 +13819,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14001,6 +14004,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14009,18 +14013,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14354,6 +14354,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14362,15 +14363,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14552,6 +14552,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14560,15 +14561,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14744,6 +14744,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14752,11 +14753,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14914,6 +14918,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14922,18 +14927,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15149,6 +15150,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15157,15 +15159,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15253,6 +15254,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15261,15 +15263,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15696,6 +15697,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15704,15 +15706,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15804,6 +15805,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15812,15 +15814,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15904,6 +15905,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15912,15 +15914,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16004,6 +16005,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16012,15 +16014,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16104,6 +16105,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16112,15 +16114,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16225,6 +16226,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16233,15 +16235,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16473,6 +16474,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16481,15 +16483,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16625,6 +16626,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16633,15 +16635,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16753,6 +16754,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16761,15 +16763,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16951,6 +16952,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16959,15 +16961,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18820,11 +18821,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19382,11 +19379,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19858,6 +19851,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19866,15 +19860,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20059,6 +20052,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20067,11 +20061,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20239,6 +20236,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20247,18 +20245,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20503,6 +20497,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20511,11 +20506,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20969,11 +20967,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21332,6 +21326,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21340,15 +21335,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21514,6 +21508,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21522,15 +21517,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21682,6 +21676,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21690,18 +21685,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22121,11 +22112,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22289,6 +22276,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22297,18 +22285,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22660,6 +22644,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22668,11 +22653,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22843,6 +22831,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22851,18 +22840,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23142,11 +23127,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23655,6 +23636,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23663,15 +23645,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23865,6 +23846,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23873,15 +23855,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24056,6 +24037,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24064,18 +24046,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24359,6 +24337,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24367,15 +24346,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24536,6 +24514,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24544,15 +24523,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24871,6 +24849,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24879,15 +24858,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25080,6 +25058,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25088,11 +25067,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25269,6 +25251,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25277,18 +25260,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25576,6 +25555,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25584,15 +25564,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25794,6 +25773,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25802,11 +25782,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25991,6 +25974,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25999,18 +25983,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py index 0af69ce3acdd..61cda5a23e8e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,18 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -334,6 +333,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -342,11 +342,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -577,6 +580,7 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -585,18 +589,14 @@ async def _delete_initial(self, resource_group_name: str, gallery_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -872,6 +872,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -880,18 +881,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,6 +1084,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1095,11 +1093,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1336,6 +1337,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1344,18 +1346,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1572,6 +1570,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1580,18 +1579,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1809,6 +1804,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1817,11 +1813,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2102,6 +2101,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2110,18 +2110,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2350,6 +2346,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2358,18 +2355,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2569,6 +2562,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2577,11 +2571,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2825,6 +2822,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2833,18 +2831,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3062,6 +3056,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3070,18 +3065,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3301,6 +3292,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3309,11 +3301,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3596,6 +3591,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3604,18 +3600,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3843,6 +3835,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3851,15 +3844,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py index 4520da49b209..da71f8c87c70 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1434,6 +1436,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1442,18 +1445,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1627,6 +1626,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1635,11 +1635,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1867,6 +1870,7 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1875,18 +1879,14 @@ def _delete_initial(self, resource_group_name: str, gallery_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2162,6 +2162,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2170,18 +2171,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2377,6 +2374,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2385,11 +2383,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2626,6 +2627,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2634,18 +2636,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2861,6 +2859,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2869,18 +2868,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3098,6 +3093,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3106,11 +3102,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3391,6 +3390,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3399,18 +3399,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3639,6 +3635,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3647,18 +3644,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3858,6 +3851,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3866,11 +3860,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4114,6 +4111,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4122,18 +4120,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4350,6 +4344,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4358,18 +4353,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4589,6 +4580,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4597,11 +4589,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4884,6 +4879,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4892,18 +4888,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5131,6 +5123,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5139,15 +5132,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/aio/operations/_operations.py index d80ad432cfd8..3ea6d32a7f1e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -677,6 +679,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -685,15 +688,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -907,6 +909,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -915,11 +918,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1114,6 +1120,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1122,18 +1129,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1313,6 +1316,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1321,15 +1325,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1525,6 +1528,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1533,15 +1537,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2113,6 +2116,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2121,15 +2125,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2325,6 +2328,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2333,15 +2337,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2514,6 +2517,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2522,15 +2526,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2684,6 +2687,7 @@ async def _reapply_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2692,18 +2696,18 @@ async def _reapply_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2813,6 +2817,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2821,15 +2826,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3005,6 +3009,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3013,15 +3018,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3200,6 +3204,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3208,15 +3213,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3389,6 +3393,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3397,15 +3402,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3582,6 +3586,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3590,15 +3595,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3778,7 @@ async def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,14 +3787,17 @@ async def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -4167,6 +4175,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4175,15 +4184,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4376,6 +4384,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4384,15 +4393,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4587,6 +4595,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4595,15 +4604,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4782,6 +4790,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4790,18 +4799,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5066,6 +5071,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5074,15 +5080,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5170,6 +5175,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5178,15 +5184,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5276,6 +5281,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5284,15 +5290,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5479,6 +5484,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5487,15 +5493,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5699,6 +5704,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5707,11 +5713,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5898,6 +5907,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5906,18 +5916,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6197,6 +6203,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6205,15 +6212,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6381,6 +6387,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6389,15 +6396,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6490,6 +6496,7 @@ async def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6498,14 +6505,17 @@ async def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -6597,6 +6607,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6605,15 +6616,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6729,6 +6739,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6737,15 +6748,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6961,6 +6971,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6969,18 +6980,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7322,6 +7329,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7330,15 +7338,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7443,6 +7450,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7451,15 +7459,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7551,6 +7558,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7559,15 +7567,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7659,6 +7666,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7667,15 +7675,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7839,6 +7846,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7847,15 +7855,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8019,6 +8026,7 @@ async def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8027,18 +8035,18 @@ async def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8232,6 +8240,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8240,15 +8249,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8459,6 +8467,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8467,15 +8476,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8669,6 +8677,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8677,11 +8686,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8859,6 +8871,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8867,18 +8880,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9213,6 +9222,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9221,15 +9231,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9416,6 +9425,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9424,15 +9434,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9649,6 +9658,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9657,11 +9667,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9855,6 +9868,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9863,18 +9877,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10090,6 +10100,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10098,15 +10109,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10196,6 +10206,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10204,15 +10215,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10642,6 +10652,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10650,15 +10661,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10750,6 +10760,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10758,15 +10769,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10850,6 +10860,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10858,15 +10869,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10950,6 +10960,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10958,15 +10969,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11050,6 +11060,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11058,15 +11069,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11171,6 +11181,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11179,15 +11190,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11421,6 +11431,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11429,15 +11440,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11577,6 +11587,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11585,15 +11596,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11705,6 +11715,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11713,15 +11724,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11903,6 +11913,7 @@ async def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11911,18 +11922,18 @@ async def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -12103,6 +12114,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12111,15 +12123,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13980,11 +13991,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14542,11 +14549,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15022,6 +15025,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15030,15 +15034,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15226,6 +15229,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15234,11 +15238,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15409,6 +15416,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15417,18 +15425,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15674,6 +15678,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15682,11 +15687,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15781,6 +15789,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15789,14 +15798,17 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -16251,11 +16263,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16695,6 +16703,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16703,15 +16712,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16877,6 +16885,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16885,15 +16894,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17045,6 +17053,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17053,18 +17062,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17484,11 +17489,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17652,6 +17653,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17660,18 +17662,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18023,6 +18021,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18031,11 +18030,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18206,6 +18208,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18214,18 +18217,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18505,11 +18504,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19018,6 +19013,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19026,15 +19022,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19228,6 +19223,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19236,15 +19232,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19419,6 +19414,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19427,18 +19423,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19722,6 +19714,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19730,15 +19723,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19900,6 +19892,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19908,15 +19901,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20236,6 +20228,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20244,15 +20237,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20445,6 +20437,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20453,11 +20446,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20634,6 +20630,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20642,18 +20639,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20941,6 +20934,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20949,15 +20943,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21159,6 +21152,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21167,11 +21161,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21356,6 +21353,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21364,18 +21362,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/operations/_operations.py index 38aec7abd159..6dc58b2b49ee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_09_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6676,6 +6678,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6684,15 +6687,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6906,6 +6908,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6914,11 +6917,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7113,6 +7119,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7121,18 +7128,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7312,6 +7315,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7320,15 +7324,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7524,6 +7527,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7532,15 +7536,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8112,6 +8115,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8120,15 +8124,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8324,6 +8327,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8332,15 +8336,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8513,6 +8516,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8521,15 +8525,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8681,6 +8684,7 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8689,18 +8693,18 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8808,6 +8812,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8816,15 +8821,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9000,6 +9004,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9008,15 +9013,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9195,6 +9199,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9203,15 +9208,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9384,6 +9388,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9392,15 +9397,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9577,6 +9581,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9585,15 +9590,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9769,6 +9773,7 @@ def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9777,14 +9782,17 @@ def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10162,6 +10170,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10170,15 +10179,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10371,6 +10379,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10379,15 +10388,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10582,6 +10590,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10590,15 +10599,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10777,6 +10785,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10785,18 +10794,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11059,6 +11064,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11067,15 +11073,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11161,6 +11166,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11169,15 +11175,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11267,6 +11272,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11275,15 +11281,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11470,6 +11475,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11478,15 +11484,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11690,6 +11695,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11698,11 +11704,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11889,6 +11898,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11897,18 +11907,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12188,6 +12194,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12196,15 +12203,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12372,6 +12378,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12380,15 +12387,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12481,6 +12487,7 @@ def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12489,14 +12496,17 @@ def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -12588,6 +12598,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12596,15 +12607,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12720,6 +12730,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12728,15 +12739,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12952,6 +12962,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12960,18 +12971,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13313,6 +13320,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13321,15 +13329,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13434,6 +13441,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13442,15 +13450,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13542,6 +13549,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13550,15 +13558,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13650,6 +13657,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13658,15 +13666,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13830,6 +13837,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13838,15 +13846,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14010,6 +14017,7 @@ def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14018,18 +14026,18 @@ def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -14220,6 +14228,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14228,15 +14237,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14444,6 +14452,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14452,15 +14461,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14654,6 +14662,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14662,11 +14671,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14844,6 +14856,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14852,18 +14865,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15197,6 +15206,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15205,15 +15215,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15400,6 +15409,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15408,15 +15418,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15630,6 +15639,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15638,11 +15648,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15833,6 +15846,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15841,18 +15855,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16068,6 +16078,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16076,15 +16087,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16172,6 +16182,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16180,15 +16191,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16615,6 +16625,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16623,15 +16634,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16723,6 +16733,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16731,15 +16742,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16823,6 +16833,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16831,15 +16842,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16923,6 +16933,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16931,15 +16942,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17023,6 +17033,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17031,15 +17042,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17144,6 +17154,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17152,15 +17163,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17392,6 +17402,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17400,15 +17411,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17544,6 +17554,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17552,15 +17563,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17672,6 +17682,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17680,15 +17691,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17870,6 +17880,7 @@ def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17878,18 +17889,18 @@ def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -18067,6 +18078,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18075,15 +18087,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19936,11 +19947,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20498,11 +20505,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20974,6 +20977,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20982,15 +20986,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21175,6 +21178,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21183,11 +21187,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21355,6 +21362,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21363,18 +21371,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21619,6 +21623,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21627,11 +21632,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21726,6 +21734,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21734,14 +21743,17 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -22196,11 +22208,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22638,6 +22646,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22646,15 +22655,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22820,6 +22828,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22828,15 +22837,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22988,6 +22996,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22996,18 +23005,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23427,11 +23432,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23595,6 +23596,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23603,18 +23605,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23966,6 +23964,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23974,11 +23973,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24149,6 +24151,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24157,18 +24160,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24448,11 +24447,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24961,6 +24956,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24969,15 +24965,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25171,6 +25166,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25179,15 +25175,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25362,6 +25357,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25370,18 +25366,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25665,6 +25657,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25673,15 +25666,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25842,6 +25834,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25850,15 +25843,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26177,6 +26169,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26185,15 +26178,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26386,6 +26378,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26394,11 +26387,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26575,6 +26571,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26583,18 +26580,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26882,6 +26875,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26890,15 +26884,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27100,6 +27093,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27108,11 +27102,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27297,6 +27294,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27305,18 +27303,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py index 613e0b4354ec..876b78e88834 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,6 +1149,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1158,15 +1158,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1346,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1355,15 +1355,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1584,6 +1583,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1592,18 +1592,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1922,6 +1918,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1930,15 +1927,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2184,6 +2180,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2192,18 +2189,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2419,6 +2412,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2427,15 +2421,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2620,6 +2613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2628,15 +2622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2864,6 +2857,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2872,18 +2866,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,6 +3400,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3418,15 +3409,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3620,6 +3610,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3628,15 +3619,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3772,6 +3762,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3780,15 +3771,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3963,6 +3953,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3971,15 +3962,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4200,6 +4190,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4208,18 +4199,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4476,6 +4463,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4484,15 +4472,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4659,6 +4646,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4667,15 +4655,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py index 516a965458fa..b67da00fe487 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2318,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,15 +2327,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2513,6 +2512,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2521,15 +2521,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,6 +2744,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2753,18 +2753,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3079,6 +3075,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3087,15 +3084,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3341,6 +3337,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3349,18 +3346,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,6 +3569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3584,15 +3578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3767,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,15 +3776,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4013,6 +4006,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4021,18 +4015,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,6 +4542,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4560,15 +4551,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,6 +4749,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4767,15 +4758,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4911,6 +4901,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4919,15 +4910,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5099,6 +5089,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5107,15 +5098,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5331,6 +5321,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5339,18 +5330,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5605,6 +5592,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5613,15 +5601,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5770,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,15 +5779,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/aio/operations/_operations.py index 84dfd3f7b56a..5e779cd6bbd8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/aio/operations/_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -677,6 +679,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -685,15 +688,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -907,6 +909,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -915,11 +918,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1114,6 +1120,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1122,18 +1129,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1313,6 +1316,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1321,15 +1325,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1525,6 +1528,7 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1533,15 +1537,14 @@ async def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2113,6 +2116,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2121,15 +2125,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2325,6 +2328,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2333,15 +2337,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2514,6 +2517,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2522,15 +2526,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2684,6 +2687,7 @@ async def _reapply_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2692,18 +2696,18 @@ async def _reapply_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2813,6 +2817,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2821,15 +2826,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3005,6 +3009,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3013,15 +3018,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3200,6 +3204,7 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3208,15 +3213,14 @@ async def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3389,6 +3393,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3397,15 +3402,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3582,6 +3586,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3590,15 +3595,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3778,7 @@ async def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,14 +3787,17 @@ async def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -4167,6 +4175,7 @@ async def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4175,15 +4184,14 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4376,6 +4384,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4384,15 +4393,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4587,6 +4595,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4595,15 +4604,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4782,6 +4790,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4790,18 +4799,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5066,6 +5071,7 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5074,15 +5080,14 @@ async def _cancel_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5170,6 +5175,7 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5178,15 +5184,14 @@ async def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5276,6 +5281,7 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5284,15 +5290,14 @@ async def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5479,6 +5484,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5487,15 +5493,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5699,6 +5704,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5707,11 +5713,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5898,6 +5907,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5906,18 +5916,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6197,6 +6203,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6205,15 +6212,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6381,6 +6387,7 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6389,15 +6396,14 @@ async def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6490,6 +6496,7 @@ async def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6498,14 +6505,17 @@ async def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -6597,6 +6607,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6605,15 +6616,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6729,6 +6739,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6737,15 +6748,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6961,6 +6971,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6969,18 +6980,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7322,6 +7329,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7330,15 +7338,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7443,6 +7450,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7451,15 +7459,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7551,6 +7558,7 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7559,15 +7567,14 @@ async def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7659,6 +7666,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7667,15 +7675,14 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7839,6 +7846,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7847,15 +7855,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8019,6 +8026,7 @@ async def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8027,18 +8035,18 @@ async def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8232,6 +8240,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8240,15 +8249,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8459,6 +8467,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8467,15 +8476,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8669,6 +8677,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8677,11 +8686,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8859,6 +8871,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8867,18 +8880,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9213,6 +9222,7 @@ async def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9221,15 +9231,14 @@ async def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9416,6 +9425,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9424,15 +9434,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9649,6 +9658,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9657,11 +9667,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9855,6 +9868,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9863,18 +9877,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10090,6 +10100,7 @@ async def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10098,15 +10109,14 @@ async def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10196,6 +10206,7 @@ async def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10204,15 +10215,14 @@ async def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10641,6 +10651,7 @@ async def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10649,15 +10660,14 @@ async def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10749,6 +10759,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10757,15 +10768,14 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10849,6 +10859,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10857,15 +10868,14 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10949,6 +10959,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10957,15 +10968,14 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11049,6 +11059,7 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11057,15 +11068,14 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11170,6 +11180,7 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11178,15 +11189,14 @@ async def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11420,6 +11430,7 @@ async def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11428,15 +11439,14 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11576,6 +11586,7 @@ async def _assess_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11584,15 +11595,14 @@ async def _assess_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11704,6 +11714,7 @@ async def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11712,15 +11723,14 @@ async def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11902,6 +11912,7 @@ async def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11910,18 +11921,18 @@ async def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -12102,6 +12113,7 @@ async def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12110,15 +12122,14 @@ async def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13979,11 +13990,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14541,11 +14548,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15021,6 +15024,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15029,15 +15033,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15225,6 +15228,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15233,11 +15237,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15408,6 +15415,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15416,18 +15424,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15673,6 +15677,7 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15681,11 +15686,14 @@ async def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15780,6 +15788,7 @@ async def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15788,14 +15797,17 @@ async def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -16250,11 +16262,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16694,6 +16702,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16702,15 +16711,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16876,6 +16884,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16884,15 +16893,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17044,6 +17052,7 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17052,18 +17061,14 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17483,11 +17488,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17651,6 +17652,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17659,18 +17661,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18022,6 +18020,7 @@ async def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18030,11 +18029,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18205,6 +18207,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18213,18 +18216,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18504,11 +18503,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19031,6 +19026,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19039,15 +19035,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19241,6 +19236,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19249,15 +19245,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19432,6 +19427,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19440,18 +19436,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19735,6 +19727,7 @@ async def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19743,15 +19736,14 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19913,6 +19905,7 @@ async def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -19921,15 +19914,14 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20249,6 +20241,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20257,15 +20250,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20458,6 +20450,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20466,11 +20459,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20647,6 +20643,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20655,18 +20652,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20954,6 +20947,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20962,15 +20956,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21172,6 +21165,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21180,11 +21174,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21369,6 +21366,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21377,18 +21375,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/operations/_operations.py index 663e1aa9e205..14a80f0689f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_01/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -6679,6 +6681,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6687,15 +6690,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6909,6 +6911,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6917,11 +6920,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7116,6 +7122,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7124,18 +7131,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7315,6 +7318,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7323,15 +7327,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7527,6 +7530,7 @@ def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -7535,15 +7539,14 @@ def _delete_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8115,6 +8118,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8123,15 +8127,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8327,6 +8330,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8335,15 +8339,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8516,6 +8519,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8524,15 +8528,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8684,6 +8687,7 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8692,18 +8696,18 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8811,6 +8815,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -8819,15 +8824,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9003,6 +9007,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9011,15 +9016,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9198,6 +9202,7 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9206,15 +9211,14 @@ def _update_instances_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9387,6 +9391,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9395,15 +9400,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9580,6 +9584,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9588,15 +9593,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9772,6 +9776,7 @@ def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -9780,14 +9785,17 @@ def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10165,6 +10173,7 @@ def _set_orchestration_service_state_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10173,15 +10182,14 @@ def _set_orchestration_service_state_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10374,6 +10382,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10382,15 +10391,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10585,6 +10593,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10593,15 +10602,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10780,6 +10788,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -10788,18 +10797,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11062,6 +11067,7 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11070,15 +11076,14 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11164,6 +11169,7 @@ def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11172,15 +11178,14 @@ def _start_os_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11270,6 +11275,7 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11278,15 +11284,14 @@ def _start_extension_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11473,6 +11478,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11481,15 +11487,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11693,6 +11698,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11701,11 +11707,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11892,6 +11901,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -11900,18 +11910,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12191,6 +12197,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12199,15 +12206,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12375,6 +12381,7 @@ def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12383,15 +12390,14 @@ def _reimage_all_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12484,6 +12490,7 @@ def _approve_rolling_upgrade_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12492,14 +12499,17 @@ def _approve_rolling_upgrade_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -12591,6 +12601,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12599,15 +12610,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12723,6 +12733,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12731,15 +12742,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12955,6 +12965,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -12963,18 +12974,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13316,6 +13323,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13324,15 +13332,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13437,6 +13444,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13445,15 +13453,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13545,6 +13552,7 @@ def _start_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13553,15 +13561,14 @@ def _start_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13653,6 +13660,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13661,15 +13669,14 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13833,6 +13840,7 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -13841,15 +13849,14 @@ def _perform_maintenance_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14013,6 +14020,7 @@ def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14021,18 +14029,18 @@ def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -14223,6 +14231,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14231,15 +14240,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14447,6 +14455,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14455,15 +14464,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14657,6 +14665,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14665,11 +14674,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14847,6 +14859,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -14855,18 +14868,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15200,6 +15209,7 @@ def _capture_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15208,15 +15218,14 @@ def _capture_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15403,6 +15412,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15411,15 +15421,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15633,6 +15642,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15641,11 +15651,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -15836,6 +15849,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -15844,18 +15858,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16071,6 +16081,7 @@ def _convert_to_managed_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16079,15 +16090,14 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16175,6 +16185,7 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16183,15 +16194,14 @@ def _deallocate_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16617,6 +16627,7 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16625,15 +16636,14 @@ def _power_off_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16725,6 +16735,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16733,15 +16744,14 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16825,6 +16835,7 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16833,15 +16844,14 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -16925,6 +16935,7 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -16933,15 +16944,14 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17025,6 +17035,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17033,15 +17044,14 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17146,6 +17156,7 @@ def _reimage_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17154,15 +17165,14 @@ def _reimage_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17394,6 +17404,7 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17402,15 +17413,14 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17546,6 +17556,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17554,15 +17565,14 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17674,6 +17684,7 @@ def _install_patches_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17682,15 +17693,14 @@ def _install_patches_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -17872,6 +17882,7 @@ def _attach_detach_data_disks_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -17880,18 +17891,18 @@ def _attach_detach_data_disks_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -18069,6 +18080,7 @@ def _run_command_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -18077,15 +18089,14 @@ def _run_command_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19938,11 +19949,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20500,11 +20507,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20976,6 +20979,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -20984,15 +20988,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21177,6 +21180,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21185,11 +21189,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21357,6 +21364,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21365,18 +21373,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21621,6 +21625,7 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21629,11 +21634,14 @@ def _restart_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21728,6 +21736,7 @@ def _redeploy_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -21736,14 +21745,17 @@ def _redeploy_initial( response = pipeline_response.http_response if response.status_code not in [202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -22198,11 +22210,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22640,6 +22648,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22648,15 +22657,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22822,6 +22830,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22830,15 +22839,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -22990,6 +22998,7 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -22998,18 +23007,14 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23429,11 +23434,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23597,6 +23598,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23605,18 +23607,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -23968,6 +23966,7 @@ def _create_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -23976,11 +23975,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24151,6 +24153,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24159,18 +24162,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24450,11 +24449,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -24977,6 +24972,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -24985,15 +24981,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25187,6 +25182,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25195,15 +25191,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25378,6 +25373,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25386,18 +25382,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25681,6 +25673,7 @@ def _export_request_rate_by_interval_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25689,15 +25682,14 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -25858,6 +25850,7 @@ def _export_throttled_requests_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -25866,15 +25859,14 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26193,6 +26185,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26201,15 +26194,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26402,6 +26394,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26410,11 +26403,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26591,6 +26587,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26599,18 +26596,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26898,6 +26891,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -26906,15 +26900,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 201: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27116,6 +27109,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27124,11 +27118,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27313,6 +27310,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -27321,18 +27319,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py index cf8315340715..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "32.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py index 9cad07d2fe88..6d7aa53b72fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -138,6 +140,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -146,15 +149,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,6 +324,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -330,15 +333,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,6 +550,7 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -556,18 +559,14 @@ async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwar response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,6 +821,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -830,15 +830,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1005,6 +1004,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1013,15 +1013,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1150,6 +1149,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1158,15 +1158,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1346,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1355,15 +1355,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1584,6 +1583,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1592,18 +1592,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1922,6 +1918,7 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1930,15 +1927,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2184,6 +2180,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2192,18 +2189,14 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2419,6 +2412,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2427,15 +2421,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2620,6 +2613,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2628,15 +2622,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2864,6 +2857,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2872,18 +2866,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3410,6 +3400,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3418,15 +3409,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3620,6 +3610,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3628,15 +3619,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3772,6 +3762,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3780,15 +3771,14 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3963,6 +3953,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3971,15 +3962,14 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4200,6 +4190,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4208,18 +4199,14 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4476,6 +4463,7 @@ async def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4484,15 +4472,14 @@ async def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4659,6 +4646,7 @@ async def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4667,15 +4655,14 @@ async def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py index 5d6142e42a78..8023d86c5e59 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -1314,6 +1316,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1322,15 +1325,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1498,6 +1500,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1506,15 +1509,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1724,6 +1726,7 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1732,18 +1735,14 @@ def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: An response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1998,6 +1997,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2006,15 +2006,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2176,6 +2175,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2184,15 +2184,14 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2319,6 +2318,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2327,15 +2327,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2513,6 +2512,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2521,15 +2521,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2745,6 +2744,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2753,18 +2753,14 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3079,6 +3075,7 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3087,15 +3084,14 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3341,6 +3337,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3349,18 +3346,14 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3576,6 +3569,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3584,15 +3578,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3774,6 +3767,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3782,15 +3776,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4013,6 +4006,7 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4021,18 +4015,14 @@ def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4552,6 +4542,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4560,15 +4551,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4759,6 +4749,7 @@ def _revoke_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4767,15 +4758,14 @@ def _revoke_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -4911,6 +4901,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4919,15 +4910,14 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5099,6 +5089,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5107,15 +5098,14 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5331,6 +5321,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5339,18 +5330,14 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5605,6 +5592,7 @@ def _grant_access_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5613,15 +5601,14 @@ def _grant_access_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5783,6 +5770,7 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5791,15 +5779,14 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * response = pipeline_response.http_response if response.status_code not in [200, 202]: - response.read() # Load the body in memory and close the socket + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 202: - deserialized = response.stream_download(self._client._pipeline) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py index c65bd549409f..8ebb1d8ff005 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations.py @@ -26,6 +26,7 @@ def test_begin_create_or_update(self, resource_group): disk_access_name="str", disk_access={ "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "name": "str", "privateEndpointConnections": [ @@ -47,7 +48,7 @@ def test_begin_create_or_update(self, resource_group): "timeCreated": "2020-02-20 00:00:00", "type": "str", }, - api_version="2020-05-01", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -60,7 +61,7 @@ def test_begin_update(self, resource_group): resource_group_name=resource_group.name, disk_access_name="str", disk_access={"tags": {"str": "str"}}, - api_version="2020-05-01", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -72,7 +73,7 @@ def test_get(self, resource_group): response = self.client.disk_accesses.get( resource_group_name=resource_group.name, disk_access_name="str", - api_version="2020-05-01", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -84,7 +85,7 @@ def test_begin_delete(self, resource_group): response = self.client.disk_accesses.begin_delete( resource_group_name=resource_group.name, disk_access_name="str", - api_version="2020-05-01", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -95,7 +96,7 @@ def test_begin_delete(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.disk_accesses.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2020-05-01", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -105,7 +106,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list(self, resource_group): response = self.client.disk_accesses.list( - api_version="2020-05-01", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -117,8 +118,67 @@ def test_get_private_link_resources(self, resource_group): response = self.client.disk_accesses.get_private_link_resources( resource_group_name=resource_group.name, disk_access_name="str", - api_version="2020-05-01", + api_version="2024-03-02", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update_a_private_endpoint_connection(self, resource_group): + response = self.client.disk_accesses.begin_update_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2024-03-02", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_a_private_endpoint_connection(self, resource_group): + response = self.client.disk_accesses.get_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + api_version="2024-03-02", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_a_private_endpoint_connection(self, resource_group): + response = self.client.disk_accesses.begin_delete_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + api_version="2024-03-02", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_private_endpoint_connections(self, resource_group): + response = self.client.disk_accesses.list_private_endpoint_connections( + resource_group_name=resource_group.name, + disk_access_name="str", + api_version="2024-03-02", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py index df7171a140af..d0583c7e8f7b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_accesses_operations_async.py @@ -28,6 +28,7 @@ async def test_begin_create_or_update(self, resource_group): disk_access_name="str", disk_access={ "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "name": "str", "privateEndpointConnections": [ @@ -49,7 +50,7 @@ async def test_begin_create_or_update(self, resource_group): "timeCreated": "2020-02-20 00:00:00", "type": "str", }, - api_version="2020-05-01", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -64,7 +65,7 @@ async def test_begin_update(self, resource_group): resource_group_name=resource_group.name, disk_access_name="str", disk_access={"tags": {"str": "str"}}, - api_version="2020-05-01", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -77,7 +78,7 @@ async def test_get(self, resource_group): response = await self.client.disk_accesses.get( resource_group_name=resource_group.name, disk_access_name="str", - api_version="2020-05-01", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -90,7 +91,7 @@ async def test_begin_delete(self, resource_group): await self.client.disk_accesses.begin_delete( resource_group_name=resource_group.name, disk_access_name="str", - api_version="2020-05-01", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -102,7 +103,7 @@ async def test_begin_delete(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.disk_accesses.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2020-05-01", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -112,7 +113,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.disk_accesses.list( - api_version="2020-05-01", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -124,8 +125,75 @@ async def test_get_private_link_resources(self, resource_group): response = await self.client.disk_accesses.get_private_link_resources( resource_group_name=resource_group.name, disk_access_name="str", - api_version="2020-05-01", + api_version="2024-03-02", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update_a_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_update_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "type": "str", + }, + api_version="2024-03-02", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_a_private_endpoint_connection(self, resource_group): + response = await self.client.disk_accesses.get_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + api_version="2024-03-02", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_a_private_endpoint_connection(self, resource_group): + response = await ( + await self.client.disk_accesses.begin_delete_a_private_endpoint_connection( + resource_group_name=resource_group.name, + disk_access_name="str", + private_endpoint_connection_name="str", + api_version="2024-03-02", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_private_endpoint_connections(self, resource_group): + response = self.client.disk_accesses.list_private_endpoint_connections( + resource_group_name=resource_group.name, + disk_access_name="str", + api_version="2024-03-02", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py index 5dfcf519a336..65691594564f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations.py @@ -27,15 +27,31 @@ def test_begin_create_or_update(self, resource_group): disk_encryption_set={ "location": "str", "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "autoKeyRotationError": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "encryptionType": "str", + "federatedClientId": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", "name": "str", "previousKeys": [{"keyUrl": "str", "sourceVault": {"id": "str"}}], "provisioningState": "str", + "rotationToLatestKeyVersionEnabled": bool, "tags": {"str": "str"}, "type": "str", }, - api_version="2019-07-01", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -47,8 +63,20 @@ def test_begin_update(self, resource_group): response = self.client.disk_encryption_sets.begin_update( resource_group_name=resource_group.name, disk_encryption_set_name="str", - disk_encryption_set={"activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, "tags": {"str": "str"}}, - api_version="2019-07-01", + disk_encryption_set={ + "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionType": "str", + "federatedClientId": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "rotationToLatestKeyVersionEnabled": bool, + "tags": {"str": "str"}, + }, + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -60,7 +88,7 @@ def test_get(self, resource_group): response = self.client.disk_encryption_sets.get( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2019-07-01", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -72,7 +100,7 @@ def test_begin_delete(self, resource_group): response = self.client.disk_encryption_sets.begin_delete( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2019-07-01", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -83,7 +111,7 @@ def test_begin_delete(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.disk_encryption_sets.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2019-07-01", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -93,7 +121,19 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list(self, resource_group): response = self.client.disk_encryption_sets.list( - api_version="2019-07-01", + api_version="2024-03-02", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_associated_resources(self, resource_group): + response = self.client.disk_encryption_sets.list_associated_resources( + resource_group_name=resource_group.name, + disk_encryption_set_name="str", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py index a5482cbc807a..c61edfc816ba 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_encryption_sets_operations_async.py @@ -29,15 +29,31 @@ async def test_begin_create_or_update(self, resource_group): disk_encryption_set={ "location": "str", "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "autoKeyRotationError": { + "code": "str", + "details": [{"code": "str", "message": "str", "target": "str"}], + "innererror": {"errordetail": "str", "exceptiontype": "str"}, + "message": "str", + "target": "str", + }, + "encryptionType": "str", + "federatedClientId": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", "name": "str", "previousKeys": [{"keyUrl": "str", "sourceVault": {"id": "str"}}], "provisioningState": "str", + "rotationToLatestKeyVersionEnabled": bool, "tags": {"str": "str"}, "type": "str", }, - api_version="2019-07-01", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -53,9 +69,18 @@ async def test_begin_update(self, resource_group): disk_encryption_set_name="str", disk_encryption_set={ "activeKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionType": "str", + "federatedClientId": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "rotationToLatestKeyVersionEnabled": bool, "tags": {"str": "str"}, }, - api_version="2019-07-01", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -68,7 +93,7 @@ async def test_get(self, resource_group): response = await self.client.disk_encryption_sets.get( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2019-07-01", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -81,7 +106,7 @@ async def test_begin_delete(self, resource_group): await self.client.disk_encryption_sets.begin_delete( resource_group_name=resource_group.name, disk_encryption_set_name="str", - api_version="2019-07-01", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -93,7 +118,7 @@ async def test_begin_delete(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.disk_encryption_sets.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2019-07-01", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -103,7 +128,19 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.disk_encryption_sets.list( - api_version="2019-07-01", + api_version="2024-03-02", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_associated_resources(self, resource_group): + response = self.client.disk_encryption_sets.list_associated_resources( + resource_group_name=resource_group.name, + disk_encryption_set_name="str", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py index b51db8e6ccd9..e221f7e91cf4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations.py @@ -26,7 +26,7 @@ def test_get(self, resource_group): restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - api_version="2020-09-30", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -39,8 +39,42 @@ def test_list_by_restore_point(self, resource_group): resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", - api_version="2020-09-30", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_grant_access(self, resource_group): + response = self.client.disk_restore_point.begin_grant_access( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + vm_restore_point_name="str", + disk_restore_point_name="str", + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, + api_version="2024-03-02", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_revoke_access(self, resource_group): + response = self.client.disk_restore_point.begin_revoke_access( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + vm_restore_point_name="str", + disk_restore_point_name="str", + api_version="2024-03-02", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py index 56382cbab5ba..8a25d360c892 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disk_restore_point_operations_async.py @@ -27,7 +27,7 @@ async def test_get(self, resource_group): restore_point_collection_name="str", vm_restore_point_name="str", disk_restore_point_name="str", - api_version="2020-09-30", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -40,8 +40,46 @@ async def test_list_by_restore_point(self, resource_group): resource_group_name=resource_group.name, restore_point_collection_name="str", vm_restore_point_name="str", - api_version="2020-09-30", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_grant_access(self, resource_group): + response = await ( + await self.client.disk_restore_point.begin_grant_access( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + vm_restore_point_name="str", + disk_restore_point_name="str", + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, + api_version="2024-03-02", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_revoke_access(self, resource_group): + response = await ( + await self.client.disk_restore_point.begin_revoke_access( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + vm_restore_point_name="str", + disk_restore_point_name="str", + api_version="2024-03-02", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py index 986661b9fc5d..ee61be3643a2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations.py @@ -26,30 +26,86 @@ def test_begin_create_or_update(self, resource_group): disk_name="str", disk={ "location": "str", - "accountType": "str", + "LastOwnershipUpdateTime": "2020-02-20 00:00:00", + "burstingEnabled": bool, + "burstingEnabledTime": "2020-02-20 00:00:00", + "completionPercent": 0.0, "creationData": { "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, + "elasticSanResourceId": "str", + "galleryImageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "imageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "logicalSectorSize": 0, + "performancePlus": bool, + "provisionedBandwidthCopySpeed": "str", + "securityDataUri": "str", "sourceResourceId": "str", + "sourceUniqueId": "str", "sourceUri": "str", "storageAccountId": "str", + "uploadSizeBytes": 0, }, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskIOPSReadOnly": 0, + "diskIOPSReadWrite": 0, + "diskMBpsReadOnly": 0, + "diskMBpsReadWrite": 0, + "diskSizeBytes": 0, "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "diskState": "str", + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "extendedLocation": {"name": "str", "type": "str"}, + "hyperVGeneration": "str", "id": "str", + "managedBy": "str", + "managedByExtended": ["str"], + "maxShares": 0, "name": "str", + "networkAccessPolicy": "str", + "optimizedForFrequentAttach": bool, "osType": "str", - "ownerId": "str", + "propertyUpdatesInProgress": {"targetTier": "str"}, "provisioningState": "str", + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, + "shareInfo": [{"vmUri": "str"}], + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, + "tier": "str", "timeCreated": "2020-02-20 00:00:00", "type": "str", + "uniqueId": "str", + "zones": ["str"], }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -62,24 +118,43 @@ def test_begin_update(self, resource_group): resource_group_name=resource_group.name, disk_name="str", disk={ - "accountType": "str", - "creationData": { - "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, - "sourceResourceId": "str", - "sourceUri": "str", - "storageAccountId": "str", - }, + "burstingEnabled": bool, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskIOPSReadOnly": 0, + "diskIOPSReadWrite": 0, + "diskMBpsReadOnly": 0, + "diskMBpsReadWrite": 0, "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "maxShares": 0, + "networkAccessPolicy": "str", + "optimizedForFrequentAttach": bool, "osType": "str", + "propertyUpdatesInProgress": {"targetTier": "str"}, + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, + "tier": "str", }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -91,7 +166,7 @@ def test_get(self, resource_group): response = self.client.disks.get( resource_group_name=resource_group.name, disk_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -103,7 +178,7 @@ def test_begin_delete(self, resource_group): response = self.client.disks.begin_delete( resource_group_name=resource_group.name, disk_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -114,7 +189,7 @@ def test_begin_delete(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.disks.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -124,7 +199,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list(self, resource_group): response = self.client.disks.list( - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -136,8 +211,13 @@ def test_begin_grant_access(self, resource_group): response = self.client.disks.begin_grant_access( resource_group_name=resource_group.name, disk_name="str", - grant_access_data={"access": "str", "durationInSeconds": 0}, - api_version="2016-04-30-preview", + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -149,7 +229,7 @@ def test_begin_revoke_access(self, resource_group): response = self.client.disks.begin_revoke_access( resource_group_name=resource_group.name, disk_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py index 5fcc4b78e169..fdebefed8503 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_disks_operations_async.py @@ -28,30 +28,86 @@ async def test_begin_create_or_update(self, resource_group): disk_name="str", disk={ "location": "str", - "accountType": "str", + "LastOwnershipUpdateTime": "2020-02-20 00:00:00", + "burstingEnabled": bool, + "burstingEnabledTime": "2020-02-20 00:00:00", + "completionPercent": 0.0, "creationData": { "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, + "elasticSanResourceId": "str", + "galleryImageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "imageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "logicalSectorSize": 0, + "performancePlus": bool, + "provisionedBandwidthCopySpeed": "str", + "securityDataUri": "str", "sourceResourceId": "str", + "sourceUniqueId": "str", "sourceUri": "str", "storageAccountId": "str", + "uploadSizeBytes": 0, }, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskIOPSReadOnly": 0, + "diskIOPSReadWrite": 0, + "diskMBpsReadOnly": 0, + "diskMBpsReadWrite": 0, + "diskSizeBytes": 0, "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "diskState": "str", + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "extendedLocation": {"name": "str", "type": "str"}, + "hyperVGeneration": "str", "id": "str", + "managedBy": "str", + "managedByExtended": ["str"], + "maxShares": 0, "name": "str", + "networkAccessPolicy": "str", + "optimizedForFrequentAttach": bool, "osType": "str", - "ownerId": "str", + "propertyUpdatesInProgress": {"targetTier": "str"}, "provisioningState": "str", + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, + "shareInfo": [{"vmUri": "str"}], + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, + "tier": "str", "timeCreated": "2020-02-20 00:00:00", "type": "str", + "uniqueId": "str", + "zones": ["str"], }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -66,24 +122,43 @@ async def test_begin_update(self, resource_group): resource_group_name=resource_group.name, disk_name="str", disk={ - "accountType": "str", - "creationData": { - "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, - "sourceResourceId": "str", - "sourceUri": "str", - "storageAccountId": "str", - }, + "burstingEnabled": bool, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskIOPSReadOnly": 0, + "diskIOPSReadWrite": 0, + "diskMBpsReadOnly": 0, + "diskMBpsReadWrite": 0, "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "maxShares": 0, + "networkAccessPolicy": "str", + "optimizedForFrequentAttach": bool, "osType": "str", + "propertyUpdatesInProgress": {"targetTier": "str"}, + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, + "tier": "str", }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -96,7 +171,7 @@ async def test_get(self, resource_group): response = await self.client.disks.get( resource_group_name=resource_group.name, disk_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -109,7 +184,7 @@ async def test_begin_delete(self, resource_group): await self.client.disks.begin_delete( resource_group_name=resource_group.name, disk_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -121,7 +196,7 @@ async def test_begin_delete(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.disks.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -131,7 +206,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.disks.list( - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -144,8 +219,13 @@ async def test_begin_grant_access(self, resource_group): await self.client.disks.begin_grant_access( resource_group_name=resource_group.name, disk_name="str", - grant_access_data={"access": "str", "durationInSeconds": 0}, - api_version="2016-04-30-preview", + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -159,7 +239,7 @@ async def test_begin_revoke_access(self, resource_group): await self.client.disks.begin_revoke_access( resource_group_name=resource_group.name, disk_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py index 68306678ba67..75685463a9fc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations.py @@ -26,30 +26,75 @@ def test_begin_create_or_update(self, resource_group): snapshot_name="str", snapshot={ "location": "str", - "accountType": "str", + "completionPercent": 0.0, + "copyCompletionError": {"errorCode": "str", "errorMessage": "str"}, "creationData": { "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, + "elasticSanResourceId": "str", + "galleryImageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "imageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "logicalSectorSize": 0, + "performancePlus": bool, + "provisionedBandwidthCopySpeed": "str", + "securityDataUri": "str", "sourceResourceId": "str", + "sourceUniqueId": "str", "sourceUri": "str", "storageAccountId": "str", + "uploadSizeBytes": 0, }, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskSizeBytes": 0, "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "diskState": "str", + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "extendedLocation": {"name": "str", "type": "str"}, + "hyperVGeneration": "str", "id": "str", + "incremental": bool, + "incrementalSnapshotFamilyId": "str", + "managedBy": "str", "name": "str", + "networkAccessPolicy": "str", "osType": "str", - "ownerId": "str", "provisioningState": "str", + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", + "uniqueId": "str", }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -62,24 +107,33 @@ def test_begin_update(self, resource_group): resource_group_name=resource_group.name, snapshot_name="str", snapshot={ - "accountType": "str", - "creationData": { - "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, - "sourceResourceId": "str", - "sourceUri": "str", - "storageAccountId": "str", - }, + "dataAccessAuthMode": "str", + "diskAccessId": "str", "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "networkAccessPolicy": "str", "osType": "str", + "publicNetworkAccess": "str", + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -91,7 +145,7 @@ def test_get(self, resource_group): response = self.client.snapshots.get( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -103,7 +157,7 @@ def test_begin_delete(self, resource_group): response = self.client.snapshots.begin_delete( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -114,7 +168,7 @@ def test_begin_delete(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.snapshots.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -124,7 +178,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list(self, resource_group): response = self.client.snapshots.list( - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r for r in response] # please add some check logic here by yourself @@ -136,8 +190,13 @@ def test_begin_grant_access(self, resource_group): response = self.client.snapshots.begin_grant_access( resource_group_name=resource_group.name, snapshot_name="str", - grant_access_data={"access": "str", "durationInSeconds": 0}, - api_version="2016-04-30-preview", + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -149,7 +208,7 @@ def test_begin_revoke_access(self, resource_group): response = self.client.snapshots.begin_revoke_access( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py index 9c830f36515f..b959b9b224db 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_snapshots_operations_async.py @@ -28,30 +28,75 @@ async def test_begin_create_or_update(self, resource_group): snapshot_name="str", snapshot={ "location": "str", - "accountType": "str", + "completionPercent": 0.0, + "copyCompletionError": {"errorCode": "str", "errorMessage": "str"}, "creationData": { "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, + "elasticSanResourceId": "str", + "galleryImageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "imageReference": { + "communityGalleryImageId": "str", + "id": "str", + "lun": 0, + "sharedGalleryImageId": "str", + }, + "logicalSectorSize": 0, + "performancePlus": bool, + "provisionedBandwidthCopySpeed": "str", + "securityDataUri": "str", "sourceResourceId": "str", + "sourceUniqueId": "str", "sourceUri": "str", "storageAccountId": "str", + "uploadSizeBytes": 0, }, + "dataAccessAuthMode": "str", + "diskAccessId": "str", + "diskSizeBytes": 0, "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "diskState": "str", + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "extendedLocation": {"name": "str", "type": "str"}, + "hyperVGeneration": "str", "id": "str", + "incremental": bool, + "incrementalSnapshotFamilyId": "str", + "managedBy": "str", "name": "str", + "networkAccessPolicy": "str", "osType": "str", - "ownerId": "str", "provisioningState": "str", + "publicNetworkAccess": "str", + "purchasePlan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str"}, + "securityProfile": {"secureVMDiskEncryptionSetId": "str", "securityType": "str"}, + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", + "uniqueId": "str", }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -66,24 +111,33 @@ async def test_begin_update(self, resource_group): resource_group_name=resource_group.name, snapshot_name="str", snapshot={ - "accountType": "str", - "creationData": { - "createOption": "str", - "imageReference": {"id": "str", "lun": 0}, - "sourceResourceId": "str", - "sourceUri": "str", - "storageAccountId": "str", - }, + "dataAccessAuthMode": "str", + "diskAccessId": "str", "diskSizeGB": 0, - "encryptionSettings": { - "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "encryption": {"diskEncryptionSetId": "str", "type": "str"}, + "encryptionSettingsCollection": { "enabled": bool, - "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + "encryptionSettings": [ + { + "diskEncryptionKey": {"secretUrl": "str", "sourceVault": {"id": "str"}}, + "keyEncryptionKey": {"keyUrl": "str", "sourceVault": {"id": "str"}}, + } + ], + "encryptionSettingsVersion": "str", }, + "networkAccessPolicy": "str", "osType": "str", + "publicNetworkAccess": "str", + "sku": {"name": "str", "tier": "str"}, + "supportedCapabilities": { + "acceleratedNetwork": bool, + "architecture": "str", + "diskControllerTypes": "str", + }, + "supportsHibernation": bool, "tags": {"str": "str"}, }, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -96,7 +150,7 @@ async def test_get(self, resource_group): response = await self.client.snapshots.get( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) # please add some check logic here by yourself @@ -109,7 +163,7 @@ async def test_begin_delete(self, resource_group): await self.client.snapshots.begin_delete( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -121,7 +175,7 @@ async def test_begin_delete(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.snapshots.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -131,7 +185,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.snapshots.list( - api_version="2016-04-30-preview", + api_version="2024-03-02", ) result = [r async for r in response] # please add some check logic here by yourself @@ -144,8 +198,13 @@ async def test_begin_grant_access(self, resource_group): await self.client.snapshots.begin_grant_access( resource_group_name=resource_group.name, snapshot_name="str", - grant_access_data={"access": "str", "durationInSeconds": 0}, - api_version="2016-04-30-preview", + grant_access_data={ + "access": "str", + "durationInSeconds": 0, + "fileFormat": "str", + "getSecureVMGuestStateSAS": bool, + }, + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result @@ -159,7 +218,7 @@ async def test_begin_revoke_access(self, resource_group): await self.client.snapshots.begin_revoke_access( resource_group_name=resource_group.name, snapshot_name="str", - api_version="2016-04-30-preview", + api_version="2024-03-02", ) ).result() # call '.result()' to poll until service return final result