From cc67a2475e79e3faafbc86040af0d29f33cc8a80 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 9 Oct 2024 04:33:50 +0000 Subject: [PATCH] CodeGen from PR 3524 in test-repo-billy/azure-rest-api-specs Merge 8cdfce7246c52eeba3458155dfd7e5099838bd39 into 8df52d62be2e13ba064fd9c0c7874dd6751c8f4f --- sdk/keyvault/azure-mgmt-keyvault/_meta.json | 10 ++-- .../mgmt/keyvault/v2016_10_01/_version.py | 2 +- .../v2016_10_01/aio/operations/_patch.py | 6 +-- .../aio/operations/_vaults_operations.py | 32 +++++-------- .../keyvault/v2016_10_01/operations/_patch.py | 5 +- .../operations/_vaults_operations.py | 32 +++++-------- .../mgmt/keyvault/v2018_02_14/_version.py | 2 +- .../v2018_02_14/aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../keyvault/v2018_02_14/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_vaults_operations.py | 38 +++++++-------- .../mgmt/keyvault/v2019_09_01/_version.py | 2 +- .../v2019_09_01/aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../keyvault/v2019_09_01/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_vaults_operations.py | 38 +++++++-------- .../keyvault/v2020_04_01_preview/_version.py | 2 +- .../operations/_managed_hsms_operations.py | 40 ++++++++-------- .../aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_secrets_operations.py | 12 +---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_managed_hsms_operations.py | 40 ++++++++-------- .../v2020_04_01_preview/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_secrets_operations.py | 12 +---- .../operations/_vaults_operations.py | 38 +++++++-------- .../keyvault/v2021_04_01_preview/_version.py | 2 +- .../operations/_managed_hsms_operations.py | 47 ++++++++++--------- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_managed_hsms_operations.py | 47 ++++++++++--------- ...private_endpoint_connections_operations.py | 16 +++---- .../v2021_04_01_preview/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_vaults_operations.py | 38 +++++++-------- .../keyvault/v2021_06_01_preview/_version.py | 2 +- .../operations/_managed_hsms_operations.py | 47 ++++++++++--------- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_secrets_operations.py | 12 +---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_managed_hsms_operations.py | 47 ++++++++++--------- ...private_endpoint_connections_operations.py | 16 +++---- .../v2021_06_01_preview/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_secrets_operations.py | 12 +---- .../operations/_vaults_operations.py | 38 +++++++-------- .../mgmt/keyvault/v2021_10_01/_version.py | 2 +- .../operations/_managed_hsms_operations.py | 47 ++++++++++--------- ...private_endpoint_connections_operations.py | 16 +++---- .../v2021_10_01/aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_secrets_operations.py | 12 +---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_managed_hsms_operations.py | 47 ++++++++++--------- ...private_endpoint_connections_operations.py | 16 +++---- .../keyvault/v2021_10_01/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_secrets_operations.py | 12 +---- .../operations/_vaults_operations.py | 38 +++++++-------- .../mgmt/keyvault/v2022_07_01/_version.py | 2 +- .../operations/_managed_hsms_operations.py | 46 ++++++++++-------- ...private_endpoint_connections_operations.py | 16 +++---- .../v2022_07_01/aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_secrets_operations.py | 12 +---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_managed_hsms_operations.py | 46 ++++++++++-------- ...private_endpoint_connections_operations.py | 16 +++---- .../keyvault/v2022_07_01/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_secrets_operations.py | 12 +---- .../operations/_vaults_operations.py | 38 +++++++-------- .../mgmt/keyvault/v2023_02_01/_version.py | 2 +- .../operations/_managed_hsms_operations.py | 46 ++++++++++-------- ...private_endpoint_connections_operations.py | 16 +++---- .../v2023_02_01/aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_secrets_operations.py | 12 +---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_managed_hsms_operations.py | 46 ++++++++++-------- ...private_endpoint_connections_operations.py | 16 +++---- .../keyvault/v2023_02_01/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_secrets_operations.py | 12 +---- .../operations/_vaults_operations.py | 38 +++++++-------- .../mgmt/keyvault/v2023_07_01/_version.py | 2 +- .../aio/operations/_keys_operations.py | 6 +-- .../operations/_managed_hsms_operations.py | 46 ++++++++++-------- ...private_endpoint_connections_operations.py | 16 +++---- .../v2023_07_01/aio/operations/_patch.py | 6 +-- ...private_endpoint_connections_operations.py | 16 +++---- .../aio/operations/_secrets_operations.py | 12 +---- .../aio/operations/_vaults_operations.py | 38 +++++++-------- .../operations/_keys_operations.py | 6 +-- .../operations/_managed_hsms_operations.py | 46 ++++++++++-------- ...private_endpoint_connections_operations.py | 16 +++---- .../keyvault/v2023_07_01/operations/_patch.py | 5 +- ...private_endpoint_connections_operations.py | 16 +++---- .../operations/_secrets_operations.py | 12 +---- .../operations/_vaults_operations.py | 38 +++++++-------- .../check_vault_name_availability.py | 2 - .../generated_samples/create_key.py | 2 - .../generated_samples/create_secret.py | 2 - .../generated_samples/create_vault.py | 2 - .../create_vault_with_network_acls.py | 2 - ...anaged_hsm_check_mhsm_name_availability.py | 2 - .../managed_hsm_create_key.py | 2 - .../managed_hsm_create_or_update.py | 2 - ...ged_hsm_put_private_endpoint_connection.py | 2 - .../generated_samples/managed_hsm_update.py | 2 - .../put_private_endpoint_connection.py | 2 - .../update_access_policies_add.py | 5 -- .../generated_samples/update_secret.py | 2 - .../generated_samples/update_vault.py | 2 - 123 files changed, 997 insertions(+), 1196 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json index 5626ca9b8bd7..b37dc9bc5760 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_meta.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_meta.json @@ -1,12 +1,12 @@ { - "commit": "2608e811fafd18657b224a0d59e1c3924a534adb", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "c1ce1f98cf3fa4fe9bd8c9149e100f4d92f03353", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.15.0", + "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/keyvault/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/keyvault/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.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/keyvault/resource-manager/readme.md", "package-2019-09": "2021-07-15 01:23:27 -0700 4fe5435a25386ee460ba89817465c7deba818284 Microsoft.KeyVault/stable/2019-09-01/keyvault.json", "package-2018-02": "2020-11-03 15:27:00 -0500 111dab2fbec96b208a78b36bb8dcefd958036476 Microsoft.KeyVault/preview/2018-02-14-preview/keyvault.json", @@ -17,5 +17,5 @@ "package-2021-10": "2023-04-10 18:34:42 -0700 33f06ff82a4c751bcbc842b7ed4da2e81b0717b6 Microsoft.KeyVault/stable/2021-10-01/managedHsm.json", "package-2022-07": "2023-09-13 16:38:17 -0700 5dd1107d5f2be8d600325d795450e1d854fbe7e8 Microsoft.KeyVault/stable/2022-07-01/keys.json", "package-2023-02": "2023-09-13 16:38:17 -0700 5dd1107d5f2be8d600325d795450e1d854fbe7e8 Microsoft.KeyVault/stable/2023-02-01/keysManagedHsm.json", - "package-2023-07": "2023-10-12 19:27:13 +0100 b594fd4145904c9bbd018f4a2ddea75c7134aee7 Microsoft.KeyVault/stable/2023-07-01/secrets.json" + "package-2023-07": "2024-10-08 21:18:39 -0700 8cdfce7246c52eeba3458155dfd7e5099838bd39 Microsoft.KeyVault/stable/2023-07-01/keys.json" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py index b70b55fb66b3..040a30da9dc6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -211,11 +213,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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -345,11 +343,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -601,11 +595,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -927,6 +917,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -935,15 +926,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py index d6256c7691f8..334f35c7eee1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py index f4e5081651d4..8c0fe7b3d6a0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -538,11 +540,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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -672,11 +670,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -928,11 +922,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1253,6 +1243,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1261,15 +1252,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py index 79670fbb3790..6eedbb6e0ac6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py @@ -16,6 +16,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -296,6 +298,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -304,22 +307,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py index 7af173be952b..716a1a7fc3b2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py @@ -32,6 +32,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, 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 @@ -400,11 +402,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,11 +654,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -982,6 +976,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -990,15 +985,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py index 2bd66104efdb..bc4e0c3b01f6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py index cdc1d03f1766..55c6b31cfbdc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py @@ -16,6 +16,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -412,6 +414,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 @@ -420,22 +423,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 91437b9b286a..05ff729df0ef 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -457,6 +459,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -465,15 +468,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 @@ -727,11 +729,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -983,11 +981,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1308,6 +1302,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1316,15 +1311,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py index c408816451a4..8e4e00890f43 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -16,6 +16,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -298,6 +300,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -306,22 +309,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py index 9a7cdde5c242..f0c707fde442 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py @@ -32,6 +32,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, 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 @@ -400,11 +402,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,11 +654,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -982,6 +976,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -990,15 +985,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py index 9c719e411990..0534f6f58a01 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py index 935ce01821c8..e63ea371d41b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -16,6 +16,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -414,6 +416,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 @@ -422,22 +425,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index a042afe5031b..7d76544f534c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -469,6 +471,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -477,15 +480,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 @@ -739,11 +741,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -995,11 +993,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,6 +1314,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1328,15 +1323,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py index ea6d0233544f..f93a0c8f9df9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -108,6 +110,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -116,16 +119,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -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,19 +311,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -481,6 +484,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -489,19 +493,15 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, 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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 680b54a3c35b..a4abf3166f10 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -16,6 +16,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -304,6 +306,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -312,22 +315,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py index c168374c3094..ec35524f087c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py @@ -206,11 +206,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,11 +355,7 @@ async def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py index 710c72d9c145..c6e2f1eedd42 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -132,6 +134,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -140,15 +143,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 @@ -410,11 +412,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,11 +673,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,6 +1007,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1021,15 +1016,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py index 7b11f1b4676e..8c3c17a2385b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -287,6 +289,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -295,16 +298,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -476,6 +478,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -484,19 +487,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -654,6 +657,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -662,19 +666,15 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py index b9604571fae0..c6f0479d93d2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py index 469692561b83..c5ff719f462c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -16,6 +16,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -420,6 +422,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 @@ -428,22 +431,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py index 0d8f33ba27c5..7e609d2c9f3c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py @@ -338,11 +338,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,11 +487,7 @@ def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py index 1123b44bc032..987d9a1d5e99 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -471,6 +473,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -479,15 +482,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 @@ -746,11 +748,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1011,11 +1009,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1341,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1355,15 +1350,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py index 5f64c7827057..76932b132a6f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -111,6 +113,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -119,16 +122,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -303,6 +305,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.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,19 +314,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -484,6 +487,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -492,22 +496,19 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -962,6 +963,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -970,7 +972,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -978,7 +983,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py index 2c6ad04f6cce..7c9a83c8da7f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -400,6 +402,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -408,22 +411,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 1af19f3c4b5e..2fa5d3e45d4b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -308,6 +310,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -316,22 +319,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py index edf1cabfc73b..9315e12830ab 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -132,6 +134,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -140,15 +143,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 @@ -410,11 +412,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,11 +673,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,6 +1007,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1021,15 +1016,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py index 0cf1cb18fe3b..afe6b92afa17 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -369,6 +371,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -377,16 +380,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -558,6 +560,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -566,19 +569,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -736,6 +739,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -744,22 +748,19 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -1214,6 +1215,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1222,7 +1224,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1230,7 +1235,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py index d6db9b6b6955..a58f45e91e80 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -533,6 +535,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 @@ -541,22 +544,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py index c87ec9bc212c..0961c17ca279 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py index f4a1afdfbc1e..c263d6796c6f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -453,6 +455,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 @@ -461,22 +464,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py index 69532ee5fdc3..c4813d886851 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -471,6 +473,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -479,15 +482,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 @@ -746,11 +748,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1011,11 +1009,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1341,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1355,15 +1350,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py index 35e378469b86..6ff1e02adc18 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -111,6 +113,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -119,16 +122,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -303,6 +305,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.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,19 +314,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -484,6 +487,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -492,22 +496,19 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -962,6 +963,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -970,7 +972,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -978,7 +983,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py index fca8423fb71b..30ee592316e1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -400,6 +402,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -408,22 +411,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py index ebf0660e1551..3b277f060f96 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -308,6 +310,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -316,22 +319,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py index 613e5496793b..9ab5890161d7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py @@ -206,11 +206,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,11 +355,7 @@ async def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py index 9519d34e55f7..cb0a6d541995 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py @@ -32,6 +32,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -132,6 +134,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -140,15 +143,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 @@ -410,11 +412,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -675,11 +673,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,6 +1007,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1021,15 +1016,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py index abcecea18485..a5a49f0c676e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -369,6 +371,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -377,16 +380,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -558,6 +560,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -566,19 +569,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -736,6 +739,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -744,22 +748,19 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -1214,6 +1215,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1222,7 +1224,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1230,7 +1235,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py index 00024e43b0cf..8991f7d00986 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -533,6 +535,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 @@ -541,22 +544,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py index 133abf6d2e10..a3b3695ec50b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py index cf25d184b920..6e4c05bb33ea 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -453,6 +455,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 @@ -461,22 +464,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py index 16ce75faa4d5..97dc42321c56 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py @@ -338,11 +338,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,11 +487,7 @@ def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py index e636cb6a7169..09f9e837a83b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -471,6 +473,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -479,15 +482,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 @@ -746,11 +748,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1011,11 +1009,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1347,6 +1341,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1355,15 +1350,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py index 7fbe368a1ed7..f8f4309cea29 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -109,6 +111,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -117,16 +120,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -294,6 +296,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -302,19 +305,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -468,6 +471,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -476,22 +480,19 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -932,6 +933,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -940,7 +942,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -948,7 +953,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py index 088be29afcf1..d648f09ba1aa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -392,6 +394,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -400,22 +403,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py index d467a5d4dbdb..c9c719adb44b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -302,6 +304,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -310,22 +313,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py index dca59c833418..67b363548740 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py @@ -209,11 +209,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,11 +355,7 @@ async def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py index 5ea6b06ed3f2..05534ca4fb00 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py @@ -32,6 +32,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, 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 @@ -400,11 +402,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,11 +654,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -982,6 +976,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -990,15 +985,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py index a6c98a8b83fa..26294b6b26ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -367,6 +369,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -375,16 +378,15 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, 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 @@ -549,6 +551,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -557,19 +560,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -720,6 +723,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -728,22 +732,19 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -1181,6 +1182,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1189,7 +1191,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1197,7 +1202,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py index 615cc5a3bd93..da0c7ad721ee 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -525,6 +527,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 @@ -533,22 +536,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py index 2badf5aafe89..e372624ad84a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py index 65330873e921..8ae76f931b17 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -447,6 +449,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 @@ -455,22 +458,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py index 1fe7769c14d4..ba592692b5a5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py @@ -341,11 +341,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,11 +487,7 @@ def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py index 85e44172334e..0994e3d33657 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -469,6 +471,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -477,15 +480,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 @@ -739,11 +741,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -995,11 +993,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,6 +1314,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1328,15 +1323,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py index a23f5a087cf6..6080a9a9c4db 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -110,6 +112,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -118,19 +121,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -298,6 +301,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -306,19 +310,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -472,6 +476,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -480,22 +485,19 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -936,6 +938,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -944,7 +947,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -952,7 +958,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py index 742711d02002..f5b2739db493 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -392,6 +394,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -400,21 +403,18 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py index 7bc332a7d5fc..71d8d83a5ba1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -302,6 +304,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -310,22 +313,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py index f78d5ab1520b..cfd75a45e835 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py @@ -209,11 +209,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,11 +355,7 @@ async def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py index 494551048ce5..408b89c5820c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py @@ -32,6 +32,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, 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 @@ -400,11 +402,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,11 +654,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -982,6 +976,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -990,15 +985,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py index 86438a5dd1f8..4441f0917778 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -398,6 +400,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -406,19 +409,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -583,6 +586,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -591,19 +595,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -754,6 +758,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -762,22 +767,19 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -1215,6 +1217,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1223,7 +1226,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1231,7 +1237,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py index 8d36793e5eb8..36957971f4fe 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -525,6 +527,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 @@ -533,21 +536,18 @@ 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) 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) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py index 00994f70077d..1afbb447275d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py index 954e368c4943..14b7cdea8085 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -447,6 +449,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 @@ -455,22 +458,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py index 29aa2ca5a50c..efa932658aeb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py @@ -341,11 +341,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,11 +487,7 @@ def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py index ce0d14042d26..1343482ea26c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -469,6 +471,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -477,15 +480,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 @@ -739,11 +741,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -995,11 +993,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,6 +1314,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1328,15 +1323,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_managed_hsms_operations.py index 43ab889e79cd..ffa7b5e1fa25 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -110,6 +112,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -118,19 +121,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -298,6 +301,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -306,19 +310,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -472,6 +476,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -480,22 +485,19 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -936,6 +938,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -944,7 +947,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -952,7 +958,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_mhsm_private_endpoint_connections_operations.py index 4a0fcd73392c..6680e907dc9f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -392,6 +394,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -400,21 +403,18 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_private_endpoint_connections_operations.py index a511134a04bf..e79ef6c3353e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -302,6 +304,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -310,22 +313,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_secrets_operations.py index 73359761cad9..1b18a00b1e68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_secrets_operations.py @@ -209,11 +209,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,11 +355,7 @@ async def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_vaults_operations.py index a449a47e5a69..cee3071f0536 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/aio/operations/_vaults_operations.py @@ -32,6 +32,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, 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 @@ -400,11 +402,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,11 +654,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -982,6 +976,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -990,15 +985,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_managed_hsms_operations.py index 8e8a56459c1c..0fbb3f7e7af6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -398,6 +400,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -406,19 +409,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -583,6 +586,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -591,19 +595,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -754,6 +758,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -762,22 +767,19 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -1215,6 +1217,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1223,7 +1226,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1231,7 +1237,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_mhsm_private_endpoint_connections_operations.py index 0fabfdc46d5f..dbd996eda4d2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_mhsm_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -525,6 +527,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 @@ -533,21 +536,18 @@ 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) 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) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_patch.py index 59bec6bbc7f5..d81ad1a571ba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_private_endpoint_connections_operations.py index f948531314d9..fcdc4302ec9e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -447,6 +449,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 @@ -455,22 +458,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_secrets_operations.py index d6480ccb30a9..973f2a15bd6b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_secrets_operations.py @@ -341,11 +341,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,11 +487,7 @@ def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_vaults_operations.py index 85ae57ea45a2..1415da667d68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_02_01/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -469,6 +471,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -477,15 +480,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 @@ -739,11 +741,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -995,11 +993,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,6 +1314,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1328,15 +1323,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/_version.py index 3b99a1418535..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.3.1" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_keys_operations.py index 2624e2025992..5ad56b1a104e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_keys_operations.py @@ -77,7 +77,7 @@ async def create_if_not_exist( ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create - subsequent versions, and does not update existing keys. + subsequent versions, and does not update existing keys. Test a trivial change. :param resource_group_name: The name of the resource group which contains the specified key vault. Required. @@ -111,7 +111,7 @@ async def create_if_not_exist( ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create - subsequent versions, and does not update existing keys. + subsequent versions, and does not update existing keys. Test a trivial change. :param resource_group_name: The name of the resource group which contains the specified key vault. Required. @@ -143,7 +143,7 @@ async def create_if_not_exist( ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create - subsequent versions, and does not update existing keys. + subsequent versions, and does not update existing keys. Test a trivial change. :param resource_group_name: The name of the resource group which contains the specified key vault. Required. diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_managed_hsms_operations.py index 5ee61b04f44b..af42e8e61df8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_managed_hsms_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -110,6 +112,7 @@ async def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -118,19 +121,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -298,6 +301,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -306,19 +310,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -472,6 +476,7 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -480,22 +485,19 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the 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.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -936,6 +938,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -944,7 +947,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -952,7 +958,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py index 16c169a8eaa0..8e97d4326e66 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -392,6 +394,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -400,21 +403,18 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_patch.py index 9b4f32f151b7..a22e2c723f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_patch.py @@ -38,6 +38,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace @@ -57,9 +58,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_mode filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -124,6 +123,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + __all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_private_endpoint_connections_operations.py index 1f1a9bb4d5cb..e947ad7c6003 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -18,6 +18,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -302,6 +304,7 @@ async def _delete_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -310,22 +313,19 @@ async def _delete_initial( response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - await response.read() # Load the body in memory and close the socket + try: + await response.read() # Load the body in memory and close the socket + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_secrets_operations.py index f9e5860b05d5..39c80c379af2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_secrets_operations.py @@ -209,11 +209,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,11 +355,7 @@ async def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_vaults_operations.py index e79f3577f704..9d8bc25f2510 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/aio/operations/_vaults_operations.py @@ -32,6 +32,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, 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 @@ -400,11 +402,7 @@ async def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,11 +654,7 @@ async def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -982,6 +976,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -990,15 +985,14 @@ async def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_keys_operations.py index 8bb70ef3a986..ecef607e826d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_keys_operations.py @@ -234,7 +234,7 @@ def create_if_not_exist( ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create - subsequent versions, and does not update existing keys. + subsequent versions, and does not update existing keys. Test a trivial change. :param resource_group_name: The name of the resource group which contains the specified key vault. Required. @@ -268,7 +268,7 @@ def create_if_not_exist( ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create - subsequent versions, and does not update existing keys. + subsequent versions, and does not update existing keys. Test a trivial change. :param resource_group_name: The name of the resource group which contains the specified key vault. Required. @@ -300,7 +300,7 @@ def create_if_not_exist( ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create - subsequent versions, and does not update existing keys. + subsequent versions, and does not update existing keys. Test a trivial change. :param resource_group_name: The name of the resource group which contains the specified key vault. Required. diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_managed_hsms_operations.py index e68cce8862df..c1c04a0fc1ce 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_managed_hsms_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -398,6 +400,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -406,19 +409,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -583,6 +586,7 @@ def _update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -591,19 +595,19 @@ 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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 @@ -754,6 +758,7 @@ def _delete_initial(self, resource_group_name: str, 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 @@ -762,22 +767,19 @@ def _delete_initial(self, resource_group_name: str, 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, 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) - - if response.status_code == 204: - 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 @@ -1215,6 +1217,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1223,7 +1226,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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) error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1231,7 +1237,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_mhsm_private_endpoint_connections_operations.py index 1a9d3215ed28..738572fc6091 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_mhsm_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -525,6 +527,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 @@ -533,21 +536,18 @@ 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) 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) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_patch.py index 944d9d4d8c8f..889bbdef75ec 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_patch.py @@ -37,6 +37,7 @@ else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + class VaultsOperations(_VaultsOperations): @distributed_trace def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Resource"]: @@ -54,9 +55,7 @@ def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Re filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") ) - api_version: Literal["2015-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", "2015-11-01") - ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_private_endpoint_connections_operations.py index 56c8937d8b4a..623ff25d9997 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_private_endpoint_connections_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -447,6 +449,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 @@ -455,22 +458,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = response.stream_download(self._client._pipeline) - if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = response.stream_download(self._client._pipeline) - - if response.status_code == 204: - 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_secrets_operations.py index 2bf4784fb4ec..ed5edeb18f91 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_secrets_operations.py @@ -341,11 +341,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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -491,11 +487,7 @@ def 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("Secret", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Secret", pipeline_response.http_response) + deserialized = self._deserialize("Secret", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_vaults_operations.py index 3b0f81eb790b..ed43ef78a9d9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2023_07_01/operations/_vaults_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged @@ -469,6 +471,7 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) + _decompress = kwargs.pop("decompress", True) _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -477,15 +480,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 @@ -739,11 +741,7 @@ def 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("Vault", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("Vault", pipeline_response.http_response) + deserialized = self._deserialize("Vault", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -995,11 +993,7 @@ def update_access_policy( map_error(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("VaultAccessPolicyParameters", pipeline_response.http_response) - - if response.status_code == 201: - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) + deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1320,6 +1314,7 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 @@ -1328,15 +1323,14 @@ def _purge_deleted_initial(self, vault_name: str, location: 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py index 73e3fe9046a4..ac93ce63f7dc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py index a5f708baa948..3d2becb92aba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py index c35cd2777c29..e950b4ac3095 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py index 878a935af216..715c514cdd1f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py index 3d08446a7015..2fceefb02b1d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py index ffa8dc0de2e2..fe9013923545 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py index 93b804b7d63a..67e673753135 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py index 3eca084fcf3c..272c29431aa1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py index 2bd33ca45449..fb523379c873 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py index 5cd878666142..ed546294a530 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py index f0b4b81cfbdc..e4a71e8a9ffb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py index a93563149aad..009fd7762c4e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py index 7ea4eec33d89..8d2426c3759d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py index ed5c070aa322..ea07bebdaf48 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient